Simplify PatternLibrary Plugin Management

Created on 21 October 2024, about 1 month ago

Problem/Motivation

The PatternLibraryPluginManager service was built with more robust functionality in mind, but in active use it doesn't need the definition filtering and categorization features it currently includes. There is also custom logic in place both within this class and in other uses calling the createInstance() method to support fallback to a less-specific plugin ID like "image.svg" to "image" if "image.svg" is unavailable. The standard solution for this in Drupal core, however, is to implement the \Drupal\Component\Plugin\FallbackPluginManagerInterface. This behavior should be consolidated into just the plugin manager class using this model.

Proposed resolution

  • Remove the unused PatternLibraryPluginDefinition class
  • Remove pattern library plugin filtering and categorization functions
  • Implement fallback handling within the plugin manager in a standard fashion
  • Remove fallback handling logic outside the plugin manager class

User interface changes

None

API changes

  • PatternLibraryPluginDefinition class is removed
  • \Drupal\patternkit\Attribute\PatternLibrary::get() and \Drupal\patternkit\Annotation\PatternLibrary::get() now return an array for the plugin definition instead of a PatternLibraryPluginDefinition instance
  • PatternLibraryPluginManager no longer implements CategorizingPluginManagerInterface
  • PatternLibraryPluginManager no longer uses FilteredPluginManagerTrait or CategorizingPluginManagerTrait
  • PatternLibraryPluginManager no longer provides getLayoutOptions() method
  • PatternLibraryPluginManager no longer provides getLayoutOptions() method
  • PatternLibraryPluginManager now implements \Drupal\Component\Plugin\FallbackPluginManagerInterface

Data model changes

None

πŸ“Œ Task
Status

Active

Version

9.1

Component

Module Core

Created by

πŸ‡ΊπŸ‡ΈUnited States slucero Arkansas

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024