You are here

class DrupalTitleMetaTag in Metatag 7

Title meta tag controller.

This extends DrupalTextMetaTag as we need to alter variables in template_preprocess_html() rather output a normal meta tag.

Hierarchy

Expanded class hierarchy of DrupalTitleMetaTag

1 string reference to 'DrupalTitleMetaTag'
metatag_metatag_info in ./metatag.metatag.inc
Implements hook_metatag_info().

File

./metatag.inc, line 676
Metatag primary classes.

View source
class DrupalTitleMetaTag extends DrupalTextMetaTag {

  /**
   * {@inheritdoc}
   */
  public function getElement(array $options = array()) {
    $element = array();
    if ($value = $this
      ->getValue($options)) {
      $element['#attached']['metatag_set_preprocess_variable'][] = array(
        'html',
        'head_title',
        decode_entities($value),
      );
      $element['#attached']['metatag_set_preprocess_variable'][] = array(
        'html',
        'head_array',
        array(
          'title' => $value,
        ),
      );
    }
    return $element;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DrupalDefaultMetaTag::$data protected property The values submitted for this tag.
DrupalDefaultMetaTag::$info protected property All of the basic information about this tag.
DrupalDefaultMetaTag::$weight protected property This item's weight; used for sorting the output.
DrupalDefaultMetaTag::convertUrlToAbsolute protected function Make sure a given URL is absolute.
DrupalDefaultMetaTag::getWeight public function Calculate the weight of this meta tag. Overrides DrupalMetaTagInterface::getWeight
DrupalDefaultMetaTag::maxlength protected function Identify the maximum length of which strings will be allowed.
DrupalDefaultMetaTag::textSummary public static function Copied from text.module with the following changes:. Overrides DrupalMetaTagInterface::textSummary
DrupalDefaultMetaTag::tidyValue protected function Remove unwanted formatting from a meta tag.
DrupalDefaultMetaTag::truncate protected function Shorten a string to a certain length using ::textSummary().
DrupalDefaultMetaTag::__construct public function Constructor. Overrides DrupalMetaTagInterface::__construct 1
DrupalTextMetaTag::getForm public function Build the form for this meta tag. Overrides DrupalDefaultMetaTag::getForm 1
DrupalTextMetaTag::getValue public function Get the string value of this meta tag. Overrides DrupalDefaultMetaTag::getValue 1
DrupalTitleMetaTag::getElement public function Get the HTML tag for this meta tag. Overrides DrupalDefaultMetaTag::getElement