Update Composer, update everything
This commit is contained in:
parent
ea3e94409f
commit
dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions
66
vendor/chi-teck/drupal-code-generator/templates/d8/service/twig-extension.twig
vendored
Normal file
66
vendor/chi-teck/drupal-code-generator/templates/d8/service/twig-extension.twig
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\{{ machine_name }};
|
||||
|
||||
{% if di %}
|
||||
use Drupal\example\ExampleInterface;
|
||||
|
||||
{% endif %}
|
||||
/**
|
||||
* Twig extension.
|
||||
*/
|
||||
class {{ class }} extends \Twig_Extension {
|
||||
|
||||
{% if di %}
|
||||
/**
|
||||
* The example service.
|
||||
*
|
||||
* @var \Drupal\example\ExampleInterface
|
||||
*/
|
||||
protected $example;
|
||||
|
||||
/**
|
||||
* Constructs a new {{ class }} instance.
|
||||
*
|
||||
* @param \Drupal\example\ExampleInterface $example
|
||||
* The example service.
|
||||
*/
|
||||
public function __construct(ExampleInterface $example) {
|
||||
$this->example = $example;
|
||||
}
|
||||
|
||||
{% endif %}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFunctions() {
|
||||
return [
|
||||
new \Twig_SimpleFunction('foo', function ($argument = NULL) {
|
||||
return 'Foo: ' . $argument;
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFilters() {
|
||||
return [
|
||||
new \Twig_SimpleFilter('bar', function ($text) {
|
||||
return str_replace('bar', 'BAR', $text);
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTests() {
|
||||
return [
|
||||
new \Twig_SimpleTest('color', function ($text) {
|
||||
return preg_match('/^#(?:[0-9a-f]{3}){1,2}$/i', $text);
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue