core-bundle/src/Resources/contao/library/Contao/Widget.php
public function getAttribute($strKey)
	{
		if (!isset($this->arrAttributes[$strKey]))
		{
			return '';
		}

		$varValue = $this->arrAttributes[$strKey];

		// Prevent the autofocus attribute from being added multiple times (see #8281)
		if ($strKey == 'autofocus')
		{
			unset($this->arrAttributes[$strKey]);
		}

		if ($strKey == 'disabled' || $strKey == 'readonly' || $strKey == 'required' || $strKey == 'autofocus' || $strKey == 'multiple')
		{
			return ' ' . $strKey;
		}
		elseif ($varValue != '')
		{
			return ' ' . $strKey . '="' . StringUtil::specialchars($varValue) . '"';
		}

		return '';
	}
public function getAttribute($strKey)
	{
		if (!isset($this->arrAttributes[$strKey]))
		{
			return '';
		}

		$varValue = $this->arrAttributes[$strKey];

		// Prevent the autofocus attribute from being added multiple times (see #8281)
		if ($strKey == 'autofocus')
		{
			unset($this->arrAttributes[$strKey]);
		}

		if ($strKey == 'disabled' || $strKey == 'readonly' || $strKey == 'required' || $strKey == 'autofocus' || $strKey == 'multiple')
		{
			return ' ' . $strKey;
		}
		elseif ($varValue != '')
		{
			return ' ' . $strKey . '="' . StringUtil::specialchars($varValue) . '"';
		}

		return '';
	}
public function getAttribute ( $ strKey ) { if ( ! isset ( $ this -> arrAttributes [ $ strKey ] ) ) { return '' ; } $ varValue = $ this -> arrAttributes [ $ strKey ] ; // Prevent the autofocus attribute from being added multiple times (see #8281) if ( $ strKey == 'autofocus' ) { unset ( $ this -> arrAttributes [ $ strKey ] ) ; } if ( $ strKey == 'disabled' || $ strKey == 'readonly' || $ strKey == 'required' || $ strKey == 'autofocus' || $ strKey == 'multiple' ) { return ' ' . $ strKey ; } elseif ( $ varValue != '' ) { return ' ' . $ strKey . '="' . StringUtil :: specialchars ( $ varValue ) . '"' ; } return '' ; }
Return a single attribute

@param string $strKey The attribute name

@return string The attribute markup
Return a single attribute