W3cubDocs

/Drupal 8

class TwigExtension

A class providing Drupal Twig extensions.

This provides a Twig extension that registers various Drupal-specific extensions to Twig, specifically Twig functions, filter, and node visitors.

Hierarchy

  • class \Drupal\Core\Template\TwigExtension extends \Twig_Extension

See also

\Drupal\Core\CoreServiceProvider

File

core/lib/Drupal/Core/Template/TwigExtension.php, line 25

Namespace

Drupal\Core\Template

Members

Name Modifiers Type Description
TwigExtension::$dateFormatter protected property The date formatter.
TwigExtension::$renderer protected property The renderer.
TwigExtension::$themeManager protected property The theme manager.
TwigExtension::$urlGenerator protected property The URL generator.
TwigExtension::attachLibrary public function Attaches an asset library to the template, and hence to the response.
TwigExtension::bubbleArgMetadata protected function Bubbles Twig template argument's cacheability & attachment metadata.
TwigExtension::escapeFilter public function Overrides twig_escape_filter().
TwigExtension::escapePlaceholder public function Provides a placeholder wrapper around ::escapeFilter.
TwigExtension::getActiveTheme public function Gets the name of the active theme.
TwigExtension::getActiveThemePath public function Gets the path of the active theme.
TwigExtension::getFilters public function
TwigExtension::getFunctions public function
TwigExtension::getLink public function Gets a rendered link from a url object.
TwigExtension::getName public function
TwigExtension::getNodeVisitors public function
TwigExtension::getPath public function Generates a URL path given a route name and parameters.
TwigExtension::getTokenParsers public function
TwigExtension::getUrl public function Generates an absolute URL given a route name and parameters.
TwigExtension::isUrlGenerationSafe public function Determines at compile time whether the generated URL will be safe.
TwigExtension::renderVar public function Wrapper around render() for twig printed output.
TwigExtension::safeJoin public function Joins several strings together safely.
TwigExtension::setDateFormatter public function Sets the date formatter.
TwigExtension::setGenerators Deprecated public function Sets the URL generator.
TwigExtension::setThemeManager public function Sets the theme manager.
TwigExtension::setUrlGenerator public function Sets the URL generator.
TwigExtension::__construct public function Constructs \Drupal\Core\Template\TwigExtension.

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Template!TwigExtension.php/class/TwigExtension/8.1.x