You are here

public function Truncate::trunc in Twig Extender 8.2

Same name and namespace in other branches
  1. 8.4 src/Plugin/TwigPlugin/Truncate.php \Drupal\twig_extender\Plugin\TwigPlugin\Truncate::trunc()
  2. 8.3 src/Plugin/TwigPlugin/Truncate.php \Drupal\twig_extender\Plugin\TwigPlugin\Truncate::trunc()
  3. 4.x src/Plugin/TwigPlugin/Truncate.php \Drupal\twig_extender\Plugin\TwigPlugin\Truncate::trunc()

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 trunc($string, $maxLength, $wordsafe = FALSE, $addEllipsis = FALSE, $minWordsafeLength = 1) {
  return Unicode::truncate($string, $maxLength, $wordsafe, $addEllipsis, $minWordsafeLength);
}