public function meta($type, $content = null, array $options = [])
{
$options += ['block' => null];
if (!is_array($type)) {
$types = ['rss' => ['type' => 'application/rss+xml', 'rel' => 'alternate', 'title' => $type, 'link' => $content], 'atom' => ['type' => 'application/atom+xml', 'title' => $type, 'link' => $content], 'icon' => ['type' => 'image/x-icon', 'rel' => 'icon', 'link' => $content], 'keywords' => ['name' => 'keywords', 'content' => $content], 'description' => ['name' => 'description', 'content' => $content], 'robots' => ['name' => 'robots', 'content' => $content], 'viewport' => ['name' => 'viewport', 'content' => $content], 'canonical' => ['rel' => 'canonical', 'link' => $content], 'next' => ['rel' => 'next', 'link' => $content], 'prev' => ['rel' => 'prev', 'link' => $content], 'first' => ['rel' => 'first', 'link' => $content], 'last' => ['rel' => 'last', 'link' => $content]];
if ($type === 'icon' && $content === null) {
$types['icon']['link'] = 'favicon.ico';
}
if (isset($types[$type])) {
$type = $types[$type];
} elseif (!isset($options['type']) && $content !== null) {
if (is_array($content) && isset($content['_ext'])) {
$type = $types[$content['_ext']];
} else {
$type = ['name' => $type, 'content' => $content];
}
} elseif (isset($options['type'], $types[$options['type']])) {
$type = $types[$options['type']];
unset($options['type']);
} else {
$type = [];
}
}
$options += $type;
$out = null;
if (isset($options['link'])) {
$options['link'] = $this->Url->assetUrl($options['link']);
if (isset($options['rel']) && $options['rel'] === 'icon') {
$out = $this->formatTemplate('metalink', ['url' => $options['link'], 'attrs' => $this->templater()->formatAttributes($options, ['block', 'link'])]);
$options['rel'] = 'shortcut icon';
}
$out .= $this->formatTemplate('metalink', ['url' => $options['link'], 'attrs' => $this->templater()->formatAttributes($options, ['block', 'link'])]);
} else {
$out = $this->formatTemplate('meta', ['attrs' => $this->templater()->formatAttributes($options, ['block', 'type'])]);
}
if (empty($options['block'])) {
return $out;
}
if ($options['block'] === true) {
$options['block'] = __FUNCTION__;
}
$this->_View->append($options['block'], $out);
}