Back to HtmlDocument class

Method addHeadLink

public \Joomla\CMS\Document\HtmlDocument
(mixed $href, mixed $relation, mixed $relType = 'rel', mixed $attribs = array())
Adds `<link>` tags to the head of the document
Parameters
  • string $href The link that is being related.
  • string $relation Relation of link.
  • string $relType Relation type attribute. Either rel or rev (default: 'rel').
  • array $attribs Associative array of remaining attributes.
Returns
  • \Joomla\CMS\Document\HtmlDocument instance of $this to allow chaining
Since
  • 1.7.0
Class: HtmlDocument
Project: Joomla

Method addHeadLink - Source code

/**
 * Adds `<link>` tags to the head of the document
 *
 * $relType defaults to 'rel' as it is the most common relation type used.
 * ('rev' refers to reverse relation, 'rel' indicates normal, forward relation.)
 * Typical tag: `<link href="/apis/index.php" rel="Start">`
 *
 * @param   string  $href      The link that is being related.
 * @param   string  $relation  Relation of link.
 * @param   string  $relType   Relation type attribute.  Either rel or rev (default: 'rel').
 * @param   array   $attribs   Associative array of remaining attributes.
 *
 * @return  HtmlDocument instance of $this to allow chaining
 *
 * @since   1.7.0
 */
public function addHeadLink($href, $relation, $relType = 'rel', $attribs = array())
{
    $this->_links[$href]['relation'] = $relation;
    $this->_links[$href]['relType'] = $relType;
    $this->_links[$href]['attribs'] = $attribs;
    return $this;
}