$this->themeManager = $theme_manager;
$this->dateFormatter = $date_formatter;
$this->fileUrlGenerator = $file_url_generator;
}
/**
* {@inheritdoc}
*/
public function getFunctions() {
return [
// This function will receive a renderable array, if an array is detected.
new TwigFunction('render_var', [$this, 'renderVar']),
// The URL and path function are defined in close parallel to those found
// in \Symfony\Bridge\Twig\Extension\RoutingExtension
new TwigFunction('url', [$this, 'getUrl'], ['is_safe_callback' => [$this, 'isUrlGenerationSafe']]),
new TwigFunction('path', [$this, 'getPath'], ['is_safe_callback' => [$this, 'isUrlGenerationSafe']]),
new TwigFunction('link', [$this, 'getLink']),
new TwigFunction('file_url', [$this, 'getFileUrl']),
new TwigFunction('attach_library', [$this, 'attachLibrary']),
new TwigFunction('active_theme_path', [$this, 'getActiveThemePath']),
new TwigFunction('active_theme', [$this, 'getActiveTheme']),
new TwigFunction('create_attribute', [$this, 'createAttribute']),
];
}