Mercurial > hg > cmmr2012-drupal-site
diff vendor/chi-teck/drupal-code-generator/templates/d8/service/twig-extension.twig @ 4:a9cd425dd02b
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:11:55 +0000 |
parents | c75dbcec494b |
children | 12f9dff5fda9 |
line wrap: on
line diff
--- a/vendor/chi-teck/drupal-code-generator/templates/d8/service/twig-extension.twig Thu Feb 28 11:14:44 2019 +0000 +++ b/vendor/chi-teck/drupal-code-generator/templates/d8/service/twig-extension.twig Thu Feb 28 13:11:55 2019 +0000 @@ -2,18 +2,34 @@ namespace Drupal\{{ machine_name }}; +{% if di %} +use Drupal\example\ExampleInterface; + +{% endif %} /** * Twig extension. */ class {{ class }} extends \Twig_Extension { +{% if di %} /** - * {@inheritdoc} + * The example service. + * + * @var \Drupal\example\ExampleInterface */ - public function getName() { - return '{{ machine_name }}'; + 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} */