9

Looking for a way to export menu configuration. The Configuration management system will export the menu itself, but not the menu links configuration. I am looking for a way to put one of those mega menus into version control to import/export through multiple environments.

If anyone has found a good way to do this. I would be greatly appreciative.

closed as too broad by kiamlaluno Sep 1 at 12:32

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

8

Menu links can come from 3 sources:

  • Views module (these can be exported when the view config is exported)
  • .links.yml file in a module (not possible to export)
  • Created menu links (Is content entities, like nodes, users, etc and is not possible to export)

I'm guessing you are creating menu links via interface, which is content. The config system can't export content, which is by design. If you wanted to synchronize content, you would need to look at the Deploy module suite. I'm not sure how well this is working atm, since it's still in alpha.

  • Thank you for the explanation. I understand the reasoning, that menu links can reference paths which Drupal assumes are nodes and that nodes are not config and are therefore non exportable via config-export. I wish it were otherwise and haven't ceased to search for ways to do this. – Emanegux Nov 30 '16 at 16:48
2

Check the Config Menu Link module.

  • Tested it on a D8.6 and would not recommend it. Would not see this as a stable solution. Had to uninstall after some nasty errors. – Stef Van Looveren Mar 13 at 13:28
1

There's also Menu Import and Export:

This module helps in exporting and importing Menu Items among cloned sites which is not possible using CMI.

This module exports the menu entity as config YAML and will be imported on subsequent instances.

0

My experience with Drupal 8 step by step

First of all, you need to install Menu Export module and activate it. After that, you will have Export Menu in the Structure part.

Steps to Export & Import

1- In the Export Menu page domain.com/admin/config/development/menu_export, you have three option, at Menu list select which menus you want to export.

2- On the Export section, export your menus.

(In this step menu setting will not be exported on YML file then you need to continue.)

3- Now you need to export system configuration from domain.com/admin/config/development/configuration/full/export or drush cex

Note: after export, you will have menu_export.export_data.yml file that contains your menu settings

4- Transfer configuration anywhere you want, then you need to import them from domain.com/admin/config/development/configuration/full/import or drush cim

5- Then you need to import menus to your system from UI domain.com/admin/config/development/menu_export/import

Important Note

Clear your cache

In some cases, mostly with Administration menu you need do and extra step. That you need to just open the edit Administration menu page and just saving it without any changes after this you should see your updated menu on administration as well.

Not the answer you're looking for? Browse other questions tagged or ask your own question.