public function Truncate::trunc in Twig Extender 8.2
Same name and namespace in other branches
- 8.4 src/Plugin/TwigPlugin/Truncate.php \Drupal\twig_extender\Plugin\TwigPlugin\Truncate::trunc()
- 8.3 src/Plugin/TwigPlugin/Truncate.php \Drupal\twig_extender\Plugin\TwigPlugin\Truncate::trunc()
- 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\TwigPluginCode
public function trunc($string, $maxLength, $wordsafe = FALSE, $addEllipsis = FALSE, $minWordsafeLength = 1) {
return Unicode::truncate($string, $maxLength, $wordsafe, $addEllipsis, $minWordsafeLength);
}