@@ -4,26 +4,29 @@ declare(strict_types=1);
44
55namespace Drupal\ {{ machine_name }}\Plugin\Field\ FieldType ;
66
7+ {% apply sort_namespaces % }
78use Drupal\Component\Utility\Random ;
9+ use Drupal\Core\Field\Attribute\FieldType ;
810use Drupal\Core\Field\FieldDefinitionInterface ;
911use Drupal\Core\Field\FieldItemBase ;
1012use Drupal\Core\Field\FieldStorageDefinitionInterface ;
11- {% if configurable_storage or configurable_instance % }
13+ {% if configurable_storage or configurable_instance % }
1214use Drupal\Core\Form\FormStateInterface ;
13- {% endif % }
15+ {% endif % }
16+ use Drupal\Core\StringTranslation\TranslatableMarkup ;
1417use Drupal\Core\TypedData\DataDefinition ;
18+ {% endapply % }
1519
1620/**
1721 * Defines the '{{ plugin_id }}' field type.
18- *
19- * @FieldType(
20- * id = "{{ plugin_id }}",
21- * label = @Translation("{{ plugin_label }}"),
22- * description = @Translation("Some description."),
23- * default_widget = "string_textfield",
24- * default_formatter = "string",
25- * )
2622 */
23+ # [FieldType(
24+ id : ' {{ plugin_id }}' ,
25+ label : new TranslatableMarkup (' {{ plugin_label }}' ),
26+ description : new TranslatableMarkup (' Some description' ),
27+ default_widget : ' string_textfield' ,
28+ default_formatter : ' string' ,
29+ )]
2730final class {{ class }} extends FieldItemBase {
2831
2932{% if configurable_storage % }
0 commit comments