1

I am new to Drupal 8, been developing only with D7 until now and I have a question regarding menus. I need to create this basic main menu for the page, but I am not sure how to export it and send to the test site, later to production environment. What is the best way to export something like this without features? I've heard something about hook_install() functions in the profile that allow this, but I cannot really find any information about this. Can someone please provide me with some guidance? Thank you in advance.

1

As far as I know, the menu itself is exportable by the built-in config management but the links are not (because the menu is config, the links are content). So when you export the configs and import it on the target environment, you get an empty menu.

What you could do is manually create the menu links programmatically during deployment. One technique is to use a "deployment module", where you use a dummy module and take advantage of hook_update_N. As for creating the menu items in Drupal 8, this answer can probably help you.

  • Thank you, I don't really care about the links itself at the moment, I just want to create a base menu that I could export and client could put his own links on the existing menu items, so not having menu links is actually fine for me, as long as they will not be reverted back to '#" on the deployment. – Viktor Jul 26 '17 at 5:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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