Back to TextField class

Method getInput

protected string
getInput
()
Method to get the field input markup.
Returns
  • string The field input markup.
Since
  • 1.7.0
Class: TextField
Project: Joomla

Method getInput - Source code

/**
 * Method to get the field input markup.
 *
 * @return  string  The field input markup.
 *
 * @since   1.7.0
 */
protected function getInput()
{
    if ($this->element['useglobal']) {
        $component = Factory::getApplication()->input->getCmd('option');
        // Get correct component for menu items
        if ($component === 'com_menus') {
            $link = $this->form->getData()->get('link');
            $uri = new Uri($link);
            $component = $uri->getVar('option', 'com_menus');
        }
        $params = ComponentHelper::getParams($component);
        $value = $params->get($this->fieldname);
        // Try with global configuration
        if (\is_null($value)) {
            $value = Factory::getApplication()->get($this->fieldname);
        }
        // Try with menu configuration
        if (\is_null($value) && Factory::getApplication()->input->getCmd('option') === 'com_menus') {
            $value = ComponentHelper::getParams('com_menus')->get($this->fieldname);
        }
        if (!\is_null($value)) {
            $value = (string) $value;
            $this->hint = Text::sprintf('JGLOBAL_USE_GLOBAL_VALUE', $value);
        }
    }
    return $this->getRenderer($this->layout)->render($this->getLayoutData());
}