diff --git a/metatag.inc b/metatag.inc index 529c1ba..49d934b 100644 --- a/metatag.inc +++ b/metatag.inc @@ -270,3 +270,34 @@ class DrupalDateIntervalMetaTag extends DrupalDefaultMetaTag { return $value; } } + +/** + * Http equiv type meta tag controller. + */ +class DrupalHttpEquivMetaTag extends DrupalTextMetaTag { + public function getElement(array $options = array()) { + $element = isset($this->info['element']) ? $this->info['element'] : array(); + + $value = $this->getValue($options); + if (strlen($value) === 0) { + return array(); + } + + $element += array( + '#theme' => 'metatag_http_equiv', + '#tag' => 'meta', + '#id' => 'metatag_' . $this->info['name'], + '#name' => $this->info['name'], + '#value' => $value, + ); + + // Add header information if desired. + if (!empty($this->info['header'])) { + $element['#attached']['drupal_add_http_header'][] = array($this->info['header'], $value); + } + + return array( + '#attached' => array('drupal_add_html_head' => array(array($element, $element['#id']))), + ); + } +} diff --git a/metatag.metatag.inc b/metatag.metatag.inc index 253ded9..6b66f47 100644 --- a/metatag.metatag.inc +++ b/metatag.metatag.inc @@ -164,7 +164,7 @@ function metatag_metatag_info() { 'class' => 'DrupalTextMetaTag', 'group' => 'advanced', ); - + $info['tags']['standout'] = array( 'label' => t('Google Standout'), 'description' => t("Highlight standout journalism on the web, especially for breaking news; used as an indicator in Google News. Warning: Don't abuse it, to be used a maximum of 7 times per calendar week!", array('@google_news' => 'https://support.google.com/news/publisher/answer/191283?hl=en&ref_topic=2484650')), @@ -238,5 +238,12 @@ function metatag_metatag_info() { 'group' => 'advanced', ); + $info['tags']['content-language'] = array( + 'label' => t('Content language'), + 'description' => '', + 'class' => 'DrupalHttpEquivMetaTag', + 'group' => 'advanced', + ); + return $info; }