You are here

public function Truncate::truncate in Twig Extender 8

Implement truncate filter.

File

src/Plugin/TwigPlugin/Truncate.php, line 24

Class

Truncate
Example plugin for truncate.

Namespace

Drupal\twig_extender\Plugin\TwigPlugin

Code

public function truncate($string, $maxLength, $wordsafe = FALSE, $addEllipsis = FALSE, $minWordsafeLength = 1) {
  return Unicode::truncate($string, $maxLength, $wordsafe, $addEllipsis, $minWordsafeLength);
}