{% extends "base/class.php.twig" %}
{% block file_path %}
\Drupal\{{module}}\Controller\{{ class_name }}.
{% endblock %}
{% block namespace_class %}
namespace Drupal\{{module}}\Controller;
{% endblock %}
{% block use_class %}
use Drupal\Core\Controller\ControllerBase;
{% if services is not empty %}
use Symfony\Component\DependencyInjection\ContainerInterface;
{% endif %}
{% endblock %}
{% block use_class_services %}
{% endblock %}
{% block class_declaration %}
/**
* Class {{ class_name }}.
*/
class {{ class_name }} extends ControllerBase {% endblock %}
{% block class_create %}
{% if services is not empty %}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
$instance = parent::create($container);
{{ serviceClassInjectionNoOverride(services) }}
return $instance;
}
{% endif %}
{% endblock %}
{% block class_methods %}
{% for route in routes %}
/**
* {{ route.method | capitalize }}.
*
* @return string
* Return Hello string.
*/
public function {{route.method}}({{ argumentsFromRoute(route.path)|join(', ') }}) {
{% if argumentsFromRoute(route.path) is not empty %}
return [
'#type' => 'markup',
'#markup' => $this->t('Implement method: {{route.method}} with parameter(s): {{ argumentsFromRoute(route.path)|join(', ') }}'),
];
{% else %}
return [
'#type' => 'markup',
'#markup' => $this->t('Implement method: {{route.method}}')
];
{% endif %}
}
{% endfor %}
{% endblock %}