You are here

public function TwigExtenderService::getFilters in Twig Extender 8

Same name and namespace in other branches
  1. 8.4 src/TwigExtenderService.php \Drupal\twig_extender\TwigExtenderService::getFilters()
  2. 8.2 src/TwigExtenderService.php \Drupal\twig_extender\TwigExtenderService::getFilters()
  3. 8.3 src/TwigExtenderService.php \Drupal\twig_extender\TwigExtenderService::getFilters()
  4. 4.x src/TwigExtenderService.php \Drupal\twig_extender\TwigExtenderService::getFilters()

Load all filter plugins.

Overrides TwigExtension::getFilters

File

src/TwigExtenderService.php, line 50

Class

TwigExtenderService
Service Provider Class for TwigExtesion Plugins.

Namespace

Drupal\twig_extender

Code

public function getFilters() {
  $filters = parent::getFilters();
  foreach ($this->plugins as $id => $plugin) {
    $plugin = $this->pluginManager
      ->createInstance($id);
    if ($plugin
      ->getType() != 'filter') {
      continue;
    }
    $filters[] = $plugin
      ->register();
  }
  return $filters;
}