public TwigExtension::getFunctions()
File
- core/lib/Drupal/Core/Template/TwigExtension.php, line 123
Class
- TwigExtension
- A class providing Drupal Twig extensions.
Namespace
Drupal\Core\Template
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | public function getFunctions() { return [ // This function will receive a renderable array, if an array is detected. new \Twig_SimpleFunction( 'render_var' , array ( $this , 'renderVar' )), // The url and path function are defined in close parallel to those found // in \Symfony\Bridge\Twig\Extension\RoutingExtension new \Twig_SimpleFunction( 'url' , array ( $this , 'getUrl' ), array ( 'is_safe_callback' => array ( $this , 'isUrlGenerationSafe' ))), new \Twig_SimpleFunction( 'path' , array ( $this , 'getPath' ), array ( 'is_safe_callback' => array ( $this , 'isUrlGenerationSafe' ))), new \Twig_SimpleFunction( 'link' , array ( $this , 'getLink' )), new \Twig_SimpleFunction( 'file_url' , function ( $uri ) { return file_url_transform_relative(file_create_url( $uri )); }), new \Twig_SimpleFunction( 'attach_library' , [ $this , 'attachLibrary' ]), new \Twig_SimpleFunction( 'active_theme_path' , [ $this , 'getActiveThemePath' ]), new \Twig_SimpleFunction( 'active_theme' , [ $this , 'getActiveTheme' ]), ]; } |
Please login to continue.