[2.0.0-alpha1] Source plugin manager: methods naming and interfaces use

Created on 10 January 2024, 11 months ago
Updated 23 February 2024, 10 months ago

In order to provide a stable API for alpha1, we need to remove ambiguity of some methods names, and rely on interfaces as much as possible.

After audit, it appears source plugins is the scope to focus on.

First step: Source plugins manager

The easy and "obvious" stuff.

  • Replace the uses of SourcePluginManager::getSourcePluginById() in Form Builder and Element Builder by a 2 steps processes (in the reverse order):
    • ContextAwarePluginManagerInterface::getDefinitionsForContexts($contexts) to get the definitions whose constraints are satisfied by a set of contexts
    • FactoryInterface::createInstance() , passing the configuration array with prop_id, prop_definition, prop_definition & form_value
  • Rename getSourcePlugins(), used by the Form Builder, by getPluginsByPropType(). And rename getSourceDefinitions() by getDefinitionsByPropTyped() and make it protected
  • Do we move getDefaultSourcePlugin() logic to PropTypeInterface::getDefaultSource() (which can replace PropTypeInterface::getDefaultSourceId() which is used nowhere else) ?

Second step: Source plugins

Current investigation. Let's talk about this.

  • Use PluginFormInterface::buildConfigurationForm() in source plugins instead of SourcePluginBase:buildSourceConfigurationForm(), moving the wrapping of SourcePluginBase::buildConfigurationForm() into the form builder. So, every expected methods in a plugin class belong to a defined interface
  • PluginFormInterface::validateConfigurationForm() is not used by the form builder. are we missing something?
  • ContextAwarePluginInterface methods are not used by the Form Builder, only internally by SourcePluginBase. is it normal ?
📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

🇫🇷France pdureau Paris

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