Quantcast
Viewing all articles
Browse latest Browse all 293641

[meta] Introduce specific annotations for each plugin type

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

NamespaceClass$owner$typeIssue
Drupal\aggregatorAggregatorPluginManageraggregatorfetcher#1969692: Add a dedicated annotation for aggregator PluginsAssigned to: dawehner
Drupal\aggregatorAggregatorPluginManageraggregatorparser#1969692: Add a dedicated annotation for aggregator PluginsAssigned to: dawehner
Drupal\aggregatorAggregatorPluginManageraggregatorprocessor#1969692: Add a dedicated annotation for aggregator PluginsAssigned to: dawehner
Drupal\Core\ArchiverArchiverManagerArchiver#2195585: Add a dedicated @Archiver annotation class
Drupal\blockBlockManagerBlock#2065721: Add a dedicated @Block plugin annotation
Drupal\ckeditorCKEditorPluginManagerCKEditorPlugin#1986988: Add a dedicated @CKEditorPlugin annotationAssigned to: tim.plunkett
Drupal\Core\ConditionConditionManagerCondition#1990156: Add a dedicated @Condition plugin annotation
Drupal\Core\ConstraintConstraintManagerValidationConstraint#2195083: Add a dedicated @Constraint annotation class
Drupal\editEditorManagerediteditor#1987140: Add a dedicated @InPlaceEditor plugin annotationAssigned to: damiankloip
Drupal\editorEditorManagereditoreditor#1992744: Add a dedicated @Editor plugin annotationAssigned to: quicksketch
Drupal\EntityEntityManagerCoreEntity#1967294: Add a dedicated @EntityType annotation
Drupal\entity_referenceSelectionPluginManagerentity_referenceselection#2016589: Add a dedicated @EntityReferenceSelection annotation
Drupal\fieldFormatterPluginManagerfieldformatter#1985344: Add a dedicated @FieldFormatter annotation
Drupal\fieldWidgetPluginManagerfieldwidget#2035315: Add a dedicated @FieldWidget annotation
Drupal\filterFilterPluginManagerFilter#1868772: Convert filters to plugins
Drupal\layoutLayoutManagerLayout#2053879: Remove layout.module from core
Drupal\languageLanguageNegotiationMethodManagerlanguageLanguageNegotiation#2195573: Add a dedicated @LanguageNegotiation annotation class
Drupal\restResourcePluginManagerrestresource#2195571: Add a dedicated @RestResource annotation class
Drupal\systemImageToolkitManagerImageToolkit#1969708: Add a dedicated annotation for @ImageToolkit plugins
Drupal\tourTipPluginManagertourtip#1967406: Add a dedicated @Tip annotationAssigned to: tim.plunkett
Drupal\Core\TypedDataTypedDataManagerDataType#1867856: Use annotation discovery for data type plugins
Drupal\viewsViewsPluginManagerviews$omg_so_many#1969388: Change notice: Add dedicated annotations for Views pluginsAssigned to: dawehner
Drupal\viewsViewsHandlerviews$omg_so_many#1965164: Add a @PluginID annotation for plugins that only need an ID, like Views handlersAssigned to: tim.plunkett
Drupal\plugin_testTestPluginManagerplugin_testPluginTest#2200953: Add a dedicated @PluginTestFruit annotation class

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue categoryTask because it is does not introduce new features or fix bugs.
Issue priorityNormal because it replaces working code with better/consistent code.
Prioritized changesPrioritized because the change improves developer experience and adds self-documentation for creating new plugins of a particular type.
DisruptionMinimally disruptive to contrib, since updating annotation types is trivial.

Viewing all articles
Browse latest Browse all 293641

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>