Upgrade path to plugin attributes

Created on 15 July 2024, 5 months ago

Problem/Motivation

With Drupal 10.2+ plugins can now use PHP Attributes instead of Annotations. It's possible for plugins to support both attributes and annotations for a transition period but they should migrate to only using attributes. As such we should decide on an upgrade path to adopting attributes in farmOS.

I found this Drupalize.me blog post to be a great resource on the background and reasons for this change: https://drupalize.me/blog/php-attributes-drupal-plugins

Change record: Plugin implementations should use PHP attributes instead of annotations β†’
Change record: Plugin types should use PHP attributes instead of annotations β†’

Two general tasks to consider:
1. FarmOS should update its own implementations of core plugin types to use attributes. With Drupal 10.3 most if not all plugin types should be compatible with attributes, but certainly by Drupal 11.
2. FarmOS should upgrade custom plugin types to use attributes. We can make this a breaking change in a major release or provide a transition period where we support both annotations and attributes.

There is an open issue for Drupal 11 to continue supporting both annotations and attributes: 🌱 [policy, no patch] Allow both annotations and attributes in Drupal 11 Active . It seems that this will be the case, largely because there are many plugin types in contrib. But Drupal 12 will likely remove support for annotations.

Steps to reproduce

N/A

Proposed resolution

Basically, start using + supporting attributes asap. The sooner we make this the "norm" in farmOS, the easier the upgrade process will be throughout farmOS contrib.

1. Update implementations of core plugin types to use attributes as they become available, some already are! Basically, lets update our implementations when we upgrade to Drupal 10.3.
2. Support both annotations and attributes for custom plugin types when farmOS upgrades to Drupal 10.3 (to be included in a minor version release of farmOS 3.x)
3. When FarmOS upgrades to Drupal 11 in a major release 4.x, only use PHP Attributes for plugins (both implemented and custom plugin types)

There is an open issue to determine if Drupal 11 will support

Remaining tasks

User interface changes

None

API changes

FarmOS provided plugin types will support both PHP attributes and annotations in a 3.x minor release, and require PHP attributes in a major 4.x release.

Data model changes

None

πŸ“Œ Task
Status

Active

Version

3.0

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States paul121 Spokane, WA

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

Comments & Activities

Production build 0.71.5 2024