1 {% extends "base/class.php.twig" %}
4 \Drupal\{{module}}\Controller\{{ class_name }}.
7 {% block namespace_class %}
8 namespace Drupal\{{module}}\Controller;
12 use Drupal\Core\Controller\ControllerBase;
13 {% if services is not empty %}
14 use Symfony\Component\DependencyInjection\ContainerInterface;
17 {% block class_declaration %}
19 * Class {{ class_name }}.
21 * @package Drupal\{{ module }}\Controller
23 class {{ class_name }} extends ControllerBase {% endblock %}
24 {% block class_construct %}
25 {% if services is not empty %}
30 public function __construct({{ servicesAsParameters(services)|join(', ') }}) {
31 {{ serviceClassInitialization(services) }}
35 {% block class_create %}
36 {% if services is not empty %}
41 public static function create(ContainerInterface $container) {
43 {{ serviceClassInjection(services) }}
49 {% block class_methods %}
50 {% for route in routes %}
52 * {{ route.method | capitalize }}.
55 * Return Hello string.
57 public function {{route.method}}({{ argumentsFromRoute(route.path)|join(', ') }}) {
58 {% if argumentsFromRoute(route.path) is not empty %}
61 '#markup' => $this->t('Implement method: {{route.method}} with parameter(s): {{ argumentsFromRoute(route.path)|join(', ') }}'),
66 '#markup' => $this->t('Implement method: {{route.method}}')