Back to HtmlDocument class

Method addFavicon

public \Joomla\CMS\Document\HtmlDocument
addFavicon
(mixed $href, mixed $type = 'image/vnd.microsoft.icon', mixed $relation = 'shortcut icon')
Adds a shortcut icon (favicon)
Parameters
  • string $href The link that is being related.
  • string $type File type
  • string $relation Relation of link
Returns
  • \Joomla\CMS\Document\HtmlDocument instance of $this to allow chaining
Since
  • 1.7.0
Class: HtmlDocument
Project: Joomla

Method addFavicon - Source code

/**
 * Adds a shortcut icon (favicon)
 *
 * This adds a link to the icon shown in the favorites list or on
 * the left of the url in the address bar. Some browsers display
 * it on the tab, as well.
 *
 * @param   string  $href      The link that is being related.
 * @param   string  $type      File type
 * @param   string  $relation  Relation of link
 *
 * @return  HtmlDocument instance of $this to allow chaining
 *
 * @since   1.7.0
 */
public function addFavicon($href, $type = 'image/vnd.microsoft.icon', $relation = 'shortcut icon')
{
    $href = str_replace('\\', '/', $href);
    $this->addHeadLink($href, $relation, 'rel', array('type' => $type));
    return $this;
}