You are here

public function DrupalDateIntervalMetaTag::getValue in Metatag 7

Get the string value of this meta tag.

Return value

string The value of this meta tag.

Overrides DrupalDefaultMetaTag::getValue

File

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

Class

DrupalDateIntervalMetaTag
Date interval meta tag controller.

Code

public function getValue(array $options = array()) {
  $value = '';
  if (!empty($this->data['value'])) {
    $interval = intval($this->data['value']);
    if (!empty($interval) && !empty($this->data['period'])) {
      $period = $this->data['period'];
      $value = format_plural($interval, '@count ' . $period, '@count ' . $period . 's');
    }
  }

  // Translate the final output string prior to output. Use the 'output'
  // i18n_string object type, and pass along the meta tag's options as the
  // context so it can be handled appropriately.
  $value = metatag_translate_metatag($value, $this->info['name'], $options, NULL, TRUE);
  return $value;
}