class TwigExtenderService in Twig Extender 8.4
Same name and namespace in other branches
- 8 src/TwigExtenderService.php \Drupal\twig_extender\TwigExtenderService
- 8.2 src/TwigExtenderService.php \Drupal\twig_extender\TwigExtenderService
- 8.3 src/TwigExtenderService.php \Drupal\twig_extender\TwigExtenderService
- 4.x src/TwigExtenderService.php \Drupal\twig_extender\TwigExtenderService
Service Provider Class for TwigExtesion Plugins.
Hierarchy
- class \Drupal\Core\Template\TwigExtension extends \Drupal\Core\Template\Twig_Extension
- class \Drupal\twig_extender\TwigExtenderService
Expanded class hierarchy of TwigExtenderService
File
- src/
TwigExtenderService.php, line 15
Namespace
Drupal\twig_extenderView source
class TwigExtenderService extends TwigExtension {
/**
* Construtor.
*/
public function __construct(RendererInterface $renderer, UrlGeneratorInterface $url_generator, ThemeManagerInterface $theme_manager, DateFormatterInterface $date_formatter, TwigPluginManagerInterface $manager) {
parent::__construct($renderer, $url_generator, $theme_manager, $date_formatter);
$this->pluginManager = $manager;
$this->plugins = $this->pluginManager
->getDefinitions();
}
/**
* Load all function plugins.
*/
public function getFunctions() {
$functions = parent::getFunctions();
foreach ($this->plugins as $id => $plugin) {
$plugin = $this->pluginManager
->createInstance($id, $plugin);
if ($plugin
->getType() != 'function') {
continue;
}
$functions[] = $plugin
->register();
}
return $functions;
}
/**
* Load all filter plugins.
*/
public function getFilters() {
$filters = parent::getFilters();
foreach ($this->plugins as $id => $plugin) {
$plugin = $this->pluginManager
->createInstance($id);
if ($plugin
->getType() != 'filter') {
continue;
}
$filters[] = $plugin
->register();
}
return $filters;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TwigExtenderService:: |
public | function |
Load all filter plugins. Overrides TwigExtension:: |
|
TwigExtenderService:: |
public | function |
Load all function plugins. Overrides TwigExtension:: |
|
TwigExtenderService:: |
public | function |
Construtor. Overrides TwigExtension:: |
|
TwigExtension:: |
protected | property | The date formatter. | |
TwigExtension:: |
protected | property | The renderer. | |
TwigExtension:: |
protected | property | The theme manager. | |
TwigExtension:: |
protected | property | The URL generator. | |
TwigExtension:: |
public | function | Attaches an asset library to the template, and hence to the response. | |
TwigExtension:: |
protected | function | Bubbles Twig template argument's cacheability & attachment metadata. | |
TwigExtension:: |
public | function | Creates an Attribute object. | |
TwigExtension:: |
public | function | Overrides twig_escape_filter(). | |
TwigExtension:: |
public | function | Provides a placeholder wrapper around ::escapeFilter. | |
TwigExtension:: |
public | function | Gets the name of the active theme. | |
TwigExtension:: |
public | function | Gets the path of the active theme. | |
TwigExtension:: |
public | function | Gets a rendered link from a url object. | |
TwigExtension:: |
public | function | ||
TwigExtension:: |
public | function | ||
TwigExtension:: |
public | function | Generates a URL path given a route name and parameters. | |
TwigExtension:: |
public | function | ||
TwigExtension:: |
public | function | Generates an absolute URL given a route name and parameters. | |
TwigExtension:: |
public | function | Determines at compile time whether the generated URL will be safe. | |
TwigExtension:: |
public | function | Wrapper around render() for twig printed output. | |
TwigExtension:: |
public | function | Joins several strings together safely. | |
TwigExtension:: |
public | function | Sets the date formatter. | |
TwigExtension:: |
public | function | Sets the URL generator. | |
TwigExtension:: |
public | function | Sets the theme manager. | |
TwigExtension:: |
public | function | Sets the URL generator. | |
TwigExtension:: |
public | function | Removes child elements from a copy of the original array. |