1 {% extends "base/class.php.twig" %}
4 \Drupal\{{module}}\Plugin\{{ plugin }}\{{class_name}}.
7 {% block namespace_class %}
8 namespace Drupal\{{module}}\Plugin\{{ plugin }};
12 {% if pluginInterface is not empty %}
13 use {{ pluginInterface }};
16 {% if services is not empty %}
17 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
18 use Symfony\Component\DependencyInjection\ContainerInterface;
22 {% block class_declaration %}
23 {% if pluginAnnotation is not empty %}
25 * @{{ plugin_annotation }}(
26 {% for property in pluginAnnotationProperties %}
27 {% if property.name == 'id' %}
28 * id = "{{- plugin_id }}",
29 {% elseif property.type == "\\Drupal\\Core\\Annotation\\Translation" %}
30 * {{ property.name }} = @Translation("{{property.description}}"),
32 * {{ property.name }} = "{{ property.type }}",
38 class {{class_name}} implements {% if plugin_interface is not empty %} {{ plugin_interface }} {% endif %}{% if services is not empty %}, ContainerFactoryPluginInterface {% endif %}{% endblock %}
39 {% block class_construct %}
40 {% if services is not empty %}
44 * @param array $configuration
45 * A configuration array containing information about the plugin instance.
46 * @param string $plugin_id
47 * The plugin_id for the plugin instance.
48 * @param string $plugin_definition
49 * The plugin implementation definition.
51 public function __construct(
55 {{ servicesAsParameters(services)|join(', \n\t') }}
57 parent::__cons truct($configuration, $plugin_id, $plugin_definition);
58 {{ serviceClassInitialization(services) }}
62 {% block class_create %}
63 {% if services is not empty %}
67 public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
72 {{ serviceClassInjection(services) }}
77 {% block class_methods %}
82 public function build() {
85 // Implement your logic
90 {% for method in pluginInterfaceMethods %}
94 {{ method.declaration }} {
95 // {{ method.description }}