Back to Document class

Method getMetaData

public string
getMetaData
(mixed $name, mixed $attribute = 'name')
Gets a meta tag.
Parameters
  • string $name Name of the meta HTML tag
  • string $attribute Attribute to use in the meta HTML tag
Returns
  • string
Since
  • 1.7.0
Class: Document
Project: Joomla

Method getMetaData - Source code

/**
 * Gets a meta tag.
 *
 * @param   string  $name       Name of the meta HTML tag
 * @param   string  $attribute  Attribute to use in the meta HTML tag
 *
 * @return  string
 *
 * @since   1.7.0
 */
public function getMetaData($name, $attribute = 'name')
{
    // B/C old http_equiv parameter.
    if (!\is_string($attribute)) {
        $attribute = $attribute == true ? 'http-equiv' : 'name';
    }
    if ($name === 'generator') {
        $result = $this->getGenerator();
    } elseif ($name === 'description') {
        $result = $this->getDescription();
    } else {
        $result = isset($this->_metaTags[$attribute]) && isset($this->_metaTags[$attribute][$name]) ? $this->_metaTags[$attribute][$name] : '';
    }
    return $result;
}