Problem/Motivation
This module allows a plugin to provide option values for a field. The module stores this in the field storage's third-party settings, like this:
third_party_settings:
list_predefined_options:
plugin_id: timezones
ConfigEntityBase handles config dependencies that come from third_party_settings, by looking at the keys in the third_party_settings, so we get:
dependencies:
module:
- list_predefined_options
- node
- options
That's all good.
However, because this module uses plugins, *another* module could be providing the plugin. For example, module Cake might provide a list of cake types.
The field storage should then have a config dependency on the Cake module, because uninstalling the Cake module will remove the plugin and break the field.
Steps to reproduce
Proposed resolution
There's a core issue for this:
✨
3rd party should be allowed to add config dependencies
Active
. Been open for a while, not going to be fixed soon I guess :(
I can see a quick fix for this though: in list_predefined_options_form_field_storage_config_edit_form_builder() we add the third party setting to the field storage. We can at that point also add dummy data with the key of the plugin-providing module, so we'd have:
third_party_settings:
list_predefined_options:
plugin_id: timezones
cake:
dummy: dummy
That would then cause ConfigEntityBase to add the dependency.
We'd need to be careful to clean that up when the plugin is changed - would need to happen at the API level to cover cases where a field storage is saved programmatically.
Remaining tasks
User interface changes
API changes
Data model changes