Problem/Motivation
- @Plugin is a dumping ground for metadata, and is often used for configuration, not metadata (information that is only useful once you have an instantiated plugin)
- It also conveys no information to those looking at a plugin implementation
- It provides no place to document the keys used by that particular annotation
- Improved DX because we're putting an emphasises on the domain instead of the "system". I don't need to know that Entity types are plugins, I just need to know what metadata I need to provide for my EntityType.
- Opportunity for custom validation/mapping in the constructor of the custom annotation class. I'd assume this is possible somehow with Plugins already, but doing it in the annotation class that you own is very intuitive and simple.
Proposed resolution
Introduce @PluginID for those that only need a plugin ID (Views handlers, Tour tips, eventually many basic ones in contrib)
Force any complex annotations to be custom classes, so they can be properly documented and discoverable.
For example, instead of @Plugin, have @EntityType.
@Plugin can be left in core for contrib, and might be extended by core annotations, but should not be used at all in core once this is done
Remaining tasks
Open issues for each plugin type
User interface changes
N/A
API changes
None yet
Sub Issues
- #1968990: Utilize Drupal\Component\Annotation\Plugin::parse() to merge in default values
- #1968970: Standardize module-provided entity info documentation and clean-up the @EntityType annotation
- #1970900: Update standards doc on plugin annotations; add @defgroup annotation
Namespace | Class | $owner | $type | Issue |
---|---|---|---|---|
Drupal\aggregator | AggregatorPluginManager | aggregator | fetcher | #1969692: Add a dedicated annotation for aggregator PluginsAssigned to: dawehner |
Drupal\aggregator | AggregatorPluginManager | aggregator | parser | #1969692: Add a dedicated annotation for aggregator PluginsAssigned to: dawehner |
Drupal\aggregator | AggregatorPluginManager | aggregator | processor | #1969692: Add a dedicated annotation for aggregator PluginsAssigned to: dawehner |
Drupal\Core\Archiver | ArchiverManager | Archiver | #2195585: Add a dedicated @Archiver annotation class | |
Drupal\block | BlockManager | Block | #2065721: Add a dedicated @Block plugin annotation | |
Drupal\ckeditor | CKEditorPluginManager | CKEditorPlugin | #1986988: Add a dedicated @CKEditorPlugin annotationAssigned to: tim.plunkett | |
Drupal\Core\Condition | ConditionManager | Condition | #1990156: Add a dedicated @Condition plugin annotation | |
Drupal\Core\Constraint | ConstraintManager | Validation | Constraint | #2195083: Add a dedicated @Constraint annotation class |
Drupal\edit | EditorManager | edit | editor | #1987140: Add a dedicated @InPlaceEditor plugin annotationAssigned to: damiankloip |
Drupal\editor | EditorManager | editor | editor | #1992744: Add a dedicated @Editor plugin annotationAssigned to: quicksketch |
Drupal\Entity | EntityManager | Core | Entity | #1967294: Add a dedicated @EntityType annotation |
Drupal\entity_reference | SelectionPluginManager | entity_reference | selection | #2016589: Add a dedicated @EntityReferenceSelection annotation |
Drupal\field | FormatterPluginManager | field | formatter | #1985344: Add a dedicated @FieldFormatter annotation |
Drupal\field | WidgetPluginManager | field | widget | #2035315: Add a dedicated @FieldWidget annotation |
Drupal\filter | FilterPluginManager | Filter | #1868772: Convert filters to plugins | |
#2053879: Remove layout.module from core | ||||
Drupal\language | LanguageNegotiationMethodManager | language | LanguageNegotiation | #2195573: Add a dedicated @LanguageNegotiation annotation class |
Drupal\rest | ResourcePluginManager | rest | resource | #2195571: Add a dedicated @RestResource annotation class |
Drupal\system | ImageToolkitManager | ImageToolkit | #1969708: Add a dedicated annotation for @ImageToolkit plugins | |
Drupal\tour | TipPluginManager | tour | tip | #1967406: Add a dedicated @Tip annotationAssigned to: tim.plunkett |
Drupal\Core\TypedData | TypedDataManager | DataType | #1867856: Use annotation discovery for data type plugins | |
Drupal\views | ViewsPluginManager | views | $omg_so_many | #1969388: Change notice: Add dedicated annotations for Views pluginsAssigned to: dawehner |
Drupal\views | ViewsHandler | views | $omg_so_many | #1965164: Add a @PluginID annotation for plugins that only need an ID, like Views handlersAssigned to: tim.plunkett |
Drupal\plugin_test | TestPluginManager | plugin_test | PluginTest | #2200953: Add a dedicated @PluginTestFruit annotation class |
Beta phase evaluation
Issue category | Task because it is does not introduce new features or fix bugs. |
---|---|
Issue priority | Normal because it replaces working code with better/consistent code. |
Prioritized changes | Prioritized because the change improves developer experience and adds self-documentation for creating new plugins of a particular type. |
Disruption | Minimally disruptive to contrib, since updating annotation types is trivial. |