You are here

public function TestExtension::getFunctions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/tests/modules/twig_extension_test/src/TwigExtension/TestExtension.php \Drupal\twig_extension_test\TwigExtension\TestExtension::getFunctions()

Generates a list of all Twig functions that this extension defines.

Return value

array A key/value array that defines custom Twig functions. The key denotes the function name used in the tag, e.g.:


  {{ testfunc() }}
  

The value is a standard PHP callback that defines what the function does.

Overrides TwigExtension::getFunctions

File

core/modules/system/tests/modules/twig_extension_test/src/TwigExtension/TestExtension.php, line 29
Contains \Drupal\twig_extension_test\TwigExtension\TestExtension.

Class

TestExtension
A test Twig extension that adds a custom function and a custom filter.

Namespace

Drupal\twig_extension_test\TwigExtension

Code

public function getFunctions() {
  return array(
    'testfunc' => new \Twig_Function_Function(array(
      'Drupal\\twig_extension_test\\TwigExtension\\TestExtension',
      'testFunction',
    )),
  );
}