You are here

protected function DrupalDefaultMetaTag::truncate in Metatag 7

Shorten a string to a certain length using ::textSummary().

Parameters

string $value: String to shorten.

Return value

string Shortened string.

2 calls to DrupalDefaultMetaTag::truncate()
DrupalDefaultMetaTag::getValue in ./metatag.inc
Get the string value of this meta tag.
DrupalTextMetaTag::getValue in ./metatag.inc
Get the string value of this meta tag.

File

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

Class

DrupalDefaultMetaTag
The default meta tag class from which all others inherit.

Code

protected function truncate($value) {
  $maxlength = $this
    ->maxlength();
  if (!empty($value) && $maxlength > 0) {
    $value = $this
      ->textSummary($value, $maxlength);
  }
  return $value;
}