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 ?
Issue fork ui_patterns-3413703
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
pdureau commentedComment #3
pdureau commentedComment #4
pdureau commentedComment #6
pdureau commentedThe MR about Source plugin manager methods https://git.drupalcode.org/project/ui_patterns/-/merge_requests/52
With:
Comment #8
pdureau commentedBefore doing the second step (about Source plugins), let's change the use of SourcePluginManager methods and remove OldSourceManagerTrait (
Comment #9
pdureau commented"Second step: Source plugins" was moved to its own issue: #3414291: [2.0.0-alpha1] Source plugins:methods naming and interfaces use
So, lets keep this issue only for source plugin manager methods.
Comment #11
pdureau commentedOnce OldSourceManagerTrait will be removed by #3395953: [2.0.0-alpha1] Add new Form Builder we will be able to close this issue
Comment #12
pdureau commented