function TwigExtension::__construct
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Template/TwigExtension.php \Drupal\Core\Template\TwigExtension::__construct()
- 10 core/modules/sdc/src/Twig/TwigExtension.php \Drupal\sdc\Twig\TwigExtension::__construct()
- 10 core/lib/Drupal/Core/Template/TwigExtension.php \Drupal\Core\Template\TwigExtension::__construct()
- 11.x core/modules/sdc/src/Twig/TwigExtension.php \Drupal\sdc\Twig\TwigExtension::__construct()
- 11.x core/lib/Drupal/Core/Template/TwigExtension.php \Drupal\Core\Template\TwigExtension::__construct()
Constructs \Drupal\Core\Template\TwigExtension.
Parameters
\Drupal\Core\Render\RendererInterface $renderer: The renderer.
\Drupal\Core\Routing\UrlGeneratorInterface $url_generator: The URL generator.
\Drupal\Core\Theme\ThemeManagerInterface $theme_manager: The theme manager.
\Drupal\Core\Datetime\DateFormatterInterface $date_formatter: The date formatter.
\Drupal\Core\File\FileUrlGeneratorInterface $file_url_generator: The file URL generator.
File
-
core/
lib/ Drupal/ Core/ Template/ TwigExtension.php, line 86
Class
- TwigExtension
- A class providing Drupal Twig extensions.
Namespace
Drupal\Core\TemplateCode
public function __construct(RendererInterface $renderer, UrlGeneratorInterface $url_generator, ThemeManagerInterface $theme_manager, DateFormatterInterface $date_formatter, FileUrlGeneratorInterface $file_url_generator = NULL) {
$this->renderer = $renderer;
$this->urlGenerator = $url_generator;
$this->themeManager = $theme_manager;
$this->dateFormatter = $date_formatter;
if (!$file_url_generator) {
@trigger_error('Calling TwigExtension::__construct() without the $file_url_generator argument is deprecated in drupal:9.3.0 and will be required in drupal:10.0.0. See https://www.drupal.org/node/2940031.', E_USER_DEPRECATED);
$file_url_generator = \Drupal::service('file_url_generator');
}
$this->fileUrlGenerator = $file_url_generator;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.