I have noticed that the export of menu doesn't support the Layout Builder.

I developed a small patch to support it, works for me.

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

Ruslan Piskarov created an issue. See original summary.

ruslan piskarov’s picture

Status: Active » Needs review
dydave’s picture

Hi Ruslan (@Ruslan Piskarov),

Thank you very much for raising this issue and for contributing a patch, it's greatly appreciated.

Just a quick comment to mention this ticket seems to be related to #2980893: New fields added to the menu cannot be exported where a more generic approach is suggested for supporting in structure_sync import/export of any additional data added by other modules, whether contrib or custom, to Menu Link content items.

Since Layout Builder isn't really a required core module and structure_sync doesn't really require it, there would be many cases where this config key wouldn't necessarily have any use, thus making this patch and config key 'layout_builder__layout' a bit unnecessary/useless.
Therefore, we could perhaps suggest implementing this feature in an additional sub-module, with a depency on drupal:layout_builder, with implementations of the hooks added in the patch from the related issue with an example of a custom implementation for menu_link_attributes at #2980893-13: New fields added to the menu cannot be exported.

However, this would certainly depend on the way maintainers choose the module should evolve, reviews/feedback on adding additional hooks (#2980893), before really being able to take this feature any further.

Otherwise, in terms of code, it could be something like adding sub-module structure_sync:structure_sync_layout_builder which could store implementations of added hooks to import/export the necessary config key 'layout_builder__layout' (in structure_sync_layout_builder.module) and perhaps a config schema file with its type definition for the structure_sync.data config validation.

Not sure if this alternative solution would make sense to you, but in any case, we would greatly appreciate if you could please try testing the suggested patch (!MR20), give us your reviews and opinions on the approach taken in this related ticket.

Feel free to let us know at any point if you have any questions or concerns on any aspects of that patch, this reply or the ticket in general, we would surely be very happy to help.
Thanks again very much for all your code contributions and in advance for your feedback.

mparker17 made their first commit to this issue’s fork.

mparker17’s picture

Issue tags: +Needs tests

To make this easier to review, I've rebased the merge request onto the latest 2.x and resolved merge conflicts. While I did my best to resolve the merge conflicts properly, it is possible that I made a mistake: please check to make sure the updated merge request still fixes the issue!

A brief glance at the code in the merge request suggests that it has no tests. The Structure Sync maintainers prefer to accept merge requests that have passing automated tests. If you need help writing tests, please ask: I would be happy to help!