TwigExtension::setGenerators

public TwigExtension::setGenerators(UrlGeneratorInterface $url_generator) Sets the URL generator. Parameters \Drupal\Core\Routing\UrlGeneratorInterface $url_generator: The URL generator. Return value $this Deprecated in Drupal 8.0.x-dev, will be removed before Drupal 9.0.0. Use \Drupal\Core\Template\TwigExtension::setUrlGenerator(). File core/lib/Drupal/Core/Template/TwigExtension.php, line 77 Class TwigExtension A class providing Drupal Twig extensions. Namespace Drupal\Core\Templ

TwigExtension::safeJoin

public TwigExtension::safeJoin(\Twig_Environment $env, $value, $glue = '') Joins several strings together safely. Parameters \Twig_Environment $env: A Twig_Environment instance. mixed[]|\Traversable|null $value: The pieces to join. string $glue: The delimiter with which to join the string. Defaults to an empty string. This value is expected to be safe for output and user provided data should never be used as a glue. Return value string The strings joined together. File core/lib/Drupal/Core/Te

TwigExtension::setDateFormatter

public TwigExtension::setDateFormatter(DateFormatterInterface $date_formatter) Sets the date formatter. Parameters \Drupal\Core\Datetime\DateFormatter $date_formatter: The date formatter. Return value $this File core/lib/Drupal/Core/Template/TwigExtension.php, line 115 Class TwigExtension A class providing Drupal Twig extensions. Namespace Drupal\Core\Template Code public function setDateFormatter(DateFormatterInterface $date_formatter) { $this->dateFormatter = $date_formatter;

TwigExtension::setThemeManager

public TwigExtension::setThemeManager(ThemeManagerInterface $theme_manager) Sets the theme manager. Parameters \Drupal\Core\Theme\ThemeManagerInterface $theme_manager: The theme manager. Return value $this File core/lib/Drupal/Core/Template/TwigExtension.php, line 102 Class TwigExtension A class providing Drupal Twig extensions. Namespace Drupal\Core\Template Code public function setThemeManager(ThemeManagerInterface $theme_manager) { $this->themeManager = $theme_manager; retu

TwigExtension::setUrlGenerator

public TwigExtension::setUrlGenerator(UrlGeneratorInterface $url_generator) Sets the URL generator. Parameters \Drupal\Core\Routing\UrlGeneratorInterface $url_generator: The URL generator. Return value $this File core/lib/Drupal/Core/Template/TwigExtension.php, line 89 Class TwigExtension A class providing Drupal Twig extensions. Namespace Drupal\Core\Template Code public function setUrlGenerator(UrlGeneratorInterface $url_generator) { $this->urlGenerator = $url_generator; ret

TwigExtension::renderVar

public TwigExtension::renderVar($arg) Wrapper around render() for twig printed output. If an object is passed which does not implement __toString(), RenderableInterface or toString() then an exception is thrown; Other objects are casted to string. However in the case that the object is an instance of a Twig_Markup object it is returned directly to support auto escaping. If an array is passed it is rendered via render() and scalar values are returned directly. Parameters mixed $arg: String, Obj

TwigExtension::getPath

public TwigExtension::getPath($name, $parameters = array(), $options = array()) Generates a URL path given a route name and parameters. Parameters $name: The name of the route. array $parameters: An associative array of route parameters names and values. array $options: (optional) An associative array of additional options. The 'absolute' option is forced to be FALSE. Return value string The generated URL path (relative URL) for the given route. See also \Drupal\Core\Routing\UrlGeneratorInte

TwigExtension::getTokenParsers

public TwigExtension::getTokenParsers() File core/lib/Drupal/Core/Template/TwigExtension.php, line 190 Class TwigExtension A class providing Drupal Twig extensions. Namespace Drupal\Core\Template Code public function getTokenParsers() { return array( new TwigTransTokenParser(), ); }

TwigExtension::isUrlGenerationSafe

public TwigExtension::isUrlGenerationSafe(\Twig_Node $args_node) Determines at compile time whether the generated URL will be safe. Saves the unneeded automatic escaping for performance reasons. The URL generation process percent encodes non-alphanumeric characters. Thus, the only character within a URL that must be escaped in HTML is the ampersand ("&") which separates query params. Thus we cannot mark the generated URL as always safe, but only when we are sure there won't be multiple quer

TwigExtension::getUrl

public TwigExtension::getUrl($name, $parameters = array(), $options = array()) Generates an absolute URL given a route name and parameters. @todo Add an option for scheme-relative URLs. Parameters $name: The name of the route. array $parameters: An associative array of route parameter names and values. array $options: (optional) An associative array of additional options. The 'absolute' option is forced to be TRUE. Return value string The generated absolute URL for the given route. File core/