You are here

public function TwigExtenderService::getFunctions in Twig Extender 4.x

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

Load all function plugins.

Overrides TwigExtension::getFunctions

File

src/TwigExtenderService.php, line 35

Class

TwigExtenderService
Service Provider Class for TwigExtesion Plugins.

Namespace

Drupal\twig_extender

Code

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