Modernize from Annotations to Attributes

Created on 21 August 2025, about 2 months ago

Problem/Motivation

Attributes are the new normal (as per D10.3).

POSTPONED UNTIL D12 OR LATER, in order to support D10.2 installations

This is core's policy change record: [#3395575] /
And some change implementations:
- https://www.drupal.org/node/3505422
- https://www.drupal.org/node/3229001

Steps to reproduce

Proposed resolution

Add the Attributes, leaving the Annotations, to preserve backwards compatibility, since the change records states:
"The plugin discovery supports that both annotations and attribute classes are defined on a plugin. Using a non-existing attribute class, will not result in an error, so in earlier version of Drupal core or the respective contributed project, it will fall back to the annotation. The annotation can be removed once a sufficiently recent version of the module providing the plugin type is required."

Remaining tasks

- convert Hooks to #[Hook('help')] --> having no problems by adding #[LegacyHook]
- convert * @Event() to ...
- convert * @FieldFormatter to ...
- convert * @FormElement to ...
- convert * @FieldType to #[FieldType()]
- convert * @FieldWidget to ...
- convert * @ViewsArgument/~Field/~Filter to ...

And to support other contributed modules:
- convert * @FeedsTarget() to ...
- convert * @FieldDiffBuilder() to ...
- convert * @MigrateField() to ...
- convert * @MigrateProcessPlugin() to ...
- convert * @SearchApiProcessor() to ...
- convert * @WebformElement() to ...

User interface changes

n/a

API changes

Example: todo

Data model changes

n/a

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

🇳🇱Netherlands johnv

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024