public function TwigExtension::getFunctions in Twig Tweak 8
Same name and namespace in other branches
- 8.2 src/TwigExtension.php \Drupal\twig_tweak\TwigExtension::getFunctions()
File
- src/
TwigExtension.php, line 25
Class
- TwigExtension
- Twig extension with some useful functions and filters.
Namespace
Drupal\twig_tweakCode
public function getFunctions() {
return [
new \Twig_SimpleFunction('drupal_view', 'views_embed_view'),
new \Twig_SimpleFunction('drupal_block', [
$this,
'drupalBlock',
]),
new \Twig_SimpleFunction('drupal_region', [
$this,
'drupalRegion',
]),
new \Twig_SimpleFunction('drupal_entity', [
$this,
'drupalEntity',
]),
new \Twig_SimpleFunction('drupal_field', [
$this,
'drupalField',
]),
new \Twig_SimpleFunction('drupal_menu', [
$this,
'drupalMenu',
]),
new \Twig_SimpleFunction('drupal_form', [
$this,
'drupalForm',
]),
new \Twig_SimpleFunction('drupal_token', [
$this,
'drupalToken',
]),
new \Twig_SimpleFunction('drupal_config', [
$this,
'drupalConfig',
]),
new \Twig_SimpleFunction('drupal_dump', [
$this,
'drupalDump',
]),
new \Twig_SimpleFunction('dd', [
$this,
'drupalDump',
]),
// Wrap drupal_set_message() because it returns some value which is not
// suitable for Twig template.
new \Twig_SimpleFunction('drupal_set_message', [
$this,
'drupalSetMessage',
]),
new \Twig_SimpleFunction('drupal_title', [
$this,
'drupalTitle',
]),
new \Twig_SimpleFunction('drupal_url', [
$this,
'drupalUrl',
]),
];
}