System information
- Drupal Core Version: 10.2+
- Menu Migration Version: 4.0.3
- PHP Version: 8.1+
Problem/Motivation
When creating export destination plugins (like AnotherMenu), configuration changes made in submitConfigurationForm() are not persisted. The entity form is directly copying plugin configuration from form state, overwriting any modifications the plugin made during submission.
Steps to reproduce
- Create an export destination plugin that modifies configuration in
submitConfigurationForm() - Example: Set
$this->configuration['some_index'] = 'calculated-value';in the plugin's submit handler - Submit the ExportType (Menu export) form
- Reload the ExportType (Menu export) entity and examine the plugin configuration
- The plugin's changes are lost; only the raw form values are saved
This applies to ImportType (Menu import) entities, and their ImportSource plugins as well.
Proposed resolution
Fixed by implementing EntityWithPluginCollectionInterface on ExportType and ImportType entities:
- Created the
AnotherMenuexport destination plugin (needed for the menu cloning feature in a related ticket). This plugin clones menu items to another menu and requires complex configuration transformation insubmitConfigurationForm(), making it an ideal test case for validating the fix. - Entities implement
EntityWithPluginCollectionInterfaceandgetPluginCollections() - Create custom plugin collection classes:
ImportSourcePluginCollectionandExportDestinationPluginCollection - Entity forms manually sync plugin configuration after calling
submitConfigurationForm()
This ensures that plugin modifications in submitConfigurationForm() are properly persisted to the entity.
Issue fork menu_migration-3563255
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
bbu23This issue blocks the clone feature.
Comment #3
bbu23Comment #5
bbu23Comment #7
bbu23