public TwigExtension::getFilters()
File
- core/lib/Drupal/Core/Template/TwigExtension.php, line 144
Class
- TwigExtension
- A class providing Drupal Twig extensions.
Namespace
Drupal\Core\Template
Code
public function getFilters() { return array( // Translation filters. new \Twig_SimpleFilter('t', 't', array('is_safe' => array('html'))), new \Twig_SimpleFilter('trans', 't', array('is_safe' => array('html'))), // The "raw" filter is not detectable when parsing "trans" tags. To detect // which prefix must be used for translation (@, !, %), we must clone the // "raw" filter and give it identifiable names. These filters should only // be used in "trans" tags. // @see TwigNodeTrans::compileString() new \Twig_SimpleFilter('placeholder', [$this, 'escapePlaceholder'], array('is_safe' => array('html'), 'needs_environment' => TRUE)), // Replace twig's escape filter with our own. new \Twig_SimpleFilter('drupal_escape', [$this, 'escapeFilter'], array('needs_environment' => TRUE, 'is_safe_callback' => 'twig_escape_filter_is_safe')), // Implements safe joining. // @todo Make that the default for |join? Upstream issue: // https://github.com/fabpot/Twig/issues/1420 new \Twig_SimpleFilter('safe_join', [$this, 'safeJoin'], ['needs_environment' => TRUE, 'is_safe' => ['html']]), // Array filters. new \Twig_SimpleFilter('without', 'twig_without'), // CSS class and ID filters. new \Twig_SimpleFilter('clean_class', '\Drupal\Component\Utility\Html::getClass'), new \Twig_SimpleFilter('clean_id', '\Drupal\Component\Utility\Html::getId'), // This filter will render a renderable array to use the string results. new \Twig_SimpleFilter('render', array($this, 'renderVar')), new \Twig_SimpleFilter('format_date', array($this->dateFormatter, 'format')), ); }
Please login to continue.