- 🇫🇮Finland mitechworld
Update 3259684_dependency_injection_fix-4.patch to fix auto-complete problem.
- Assigned to hassenber
Current implementation of ExternalDataSourceSelectWidget and ExternalDataSourceCheckboxesWidget break dependency injection when writing own plugin and using this design pattern.
* Write your own plugin (below called "LubriOrganizations") extending ExternalDataSourceBase, implementing ContainerFactoryPluginInterface (like any other plugin).
* Try to inject your own services
* Following error will be generated when adding External Data Source field:
[20-Jan-2022 21:45:51 Europe/Amsterdam] ArgumentCountError: Too few arguments to function Drupal\lubri_organizations_field\Plugin\ExternalDataSource\LubriOrganizations::__construct(), 0 passed in /Users/vinlaurens/Sites/advisor/web/modules/contrib/external_data_source/src/Plugin/Field/FieldWidget/ExternalDataSourceSelectWidget.php on line 126 and exactly 1 expected in ...
The error is caused by how ExternalDataSourceSelectWidget instantiates the plugin class. It currently does that as follows:
$pluginInstance = new $plugin_definitions[$settingPlugin]['class']();
While this would be desired to solve this issue:
$pluginInstance = $this->plugin_manager->createInstance($settingPlugin);
Inject the appropriate plugin manager.
Please apply and review the patch I will attach.
None.
None.
None.
Needs review
3.1
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Update 3259684_dependency_injection_fix-4.patch to fix auto-complete problem.