Make SDC extensible

Created on 2 October 2023, about 1 year ago

Problem/Motivation

We are planning to rewrite UI Patterns β†’ upon SDC. To achieve this, we are proposing a few changes and additions:

They are many final classes today in SDC:

  • ComponentPluginManager
  • ComponentNegotiator
  • Component/ComponentMetadata
  • Component/SchemaCompatibilityChecker
  • Component/ComponentValidator
  • Plugin/Component
  • Plugin/Discovery/RegexRecursiveFilterIterator
  • Plugin/Discovery/DirectoryWithMetadataPluginDiscovery
  • Plugin/Discovery/DirectoryWithMetadataDiscovery
  • Utilities
  • Exception/ComponentNotFoundException
  • Exception/InvalidComponentException
  • Exception/InvalidComponentDataException
  • Exception/IncompatibleComponentSchema
  • Twig/TwigExtension
  • Twig/ComponentNodeVisitor

They are nothing wrong about using the "final" keyword on classes, and SDC is still extensible by overriding the services:

  • Drupal\sdc\Twig\TwigComponentLoader
  • Drupal\sdc\ComponentNegotiator
  • Drupal\sdc\Twig\TwigExtension
  • plugin.manager.sdc
  • Drupal\sdc\Component\SchemaCompatibilityChecker
  • Drupal\sdc\Component\ComponentValidator

However, there are few issues about extending SDC:

Proposed resolution

  • Adopt future-proof services ID, which will not change if SDC move to a different PHP namespace
  • Provides PHP interfaces and use them in current classes under the Drupal\sdc namespace
  • Remove the final class for each class with at least one public method which doesn't belong to an interface

Remaining tasks

If there is a chance for this feature to be accepted, we (UI Patterns team) can propose a merge request soon. However, I guess SDC team will want to decide which interfaces to introduce and how to name the services.

We have one month before the release of Drupal 10.2.0-alpha1.

API changes

Changing the service names may be breaking, but I doubt any contrib project is using them already, for the reasons explained in this issue.

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component
single-directory componentsΒ  β†’

Last updated about 7 hours ago

Created by

πŸ‡«πŸ‡·France pdureau Paris

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

Comments & Activities

Production build 0.71.5 2024