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

  1. Create an export destination plugin that modifies configuration in submitConfigurationForm()
  2. Example: Set $this->configuration['some_index'] = 'calculated-value'; in the plugin's submit handler
  3. Submit the ExportType (Menu export) form
  4. Reload the ExportType (Menu export) entity and examine the plugin configuration
  5. 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:

  1. Created the AnotherMenu export 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 in submitConfigurationForm(), making it an ideal test case for validating the fix.
  2. Entities implement EntityWithPluginCollectionInterface and getPluginCollections()
  3. Create custom plugin collection classes: ImportSourcePluginCollection and ExportDestinationPluginCollection
  4. Entity forms manually sync plugin configuration after calling submitConfigurationForm()

This ensures that plugin modifications in submitConfigurationForm() are properly persisted to the entity.

Command icon 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

bbu23 created an issue. See original summary.

bbu23’s picture

This issue blocks the clone feature.

bbu23’s picture

Issue summary: View changes

bbu23’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

bbu23’s picture

Assigned: bbu23 » Unassigned

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.