I am getting desperate here trying to find a way to do something as simple as exporting and importing menus with their items.
The only exportable thing about a menu out of the box is the menu itself, but not its items, so it’s kind of useless. Apparently there are no modules out there that can do the job in the same way as we used to do it in D7. More info: https://drupal.stackexchange.com/questions/180260/how-do-i-export-my-site-structure
The couple of modules I tried didn’t do the trick, since they were supposed to be used alongside Drush or some other server tricks:
There’s a port of the original D7’s menu import that I normally used to do this, but it’s stalled for the moment, and I don’t have time to contribute (although I might do in the future):
So the question is: do you Drupal masters know about a way to synchronize menus between sites? Or better still: will we have access to Drush anytime soon?
we already offer access to drush for test websites. So please try it ( /_site/drush.php )
I will test the other options like Deploy module and menu_export and come back with my feedback afterwards
to export and import menus. You need to enable the module Menu Export, after that:
- Go to /admin/config/development/menu_export, select the menu that you need and save it.
- Go to the tab export (/admin/config/development/menu_export/export) and export the selected menu.
- Go to /admin/config/development/configuration/single/export select in Configuration type list “Simple Configuration” and select in Configuration name list the items menu “menu_export.export_data”
when you do that in the field “Here is your configuration:” you will get your configuration for your menus them copy it,
In your new site
- Go to (/admin/config/development/configuration/single/import) in order to import your configuration.
- select Configuration type “Simple Configuration” and Paste your configuration in a field “Paste your configuration here” , them import it
Play around this steps in order to import your menu. The configuration synchronization is the way to synchronize to sites, your able to export your full site configuration and import in other site or you can select single files.
thanks for your reply. I forgot to mention that I tried this but it failed. I think the problem is my source and target sites are different (they didn’t diverge from an initial clone), so the menu items UUIDs were different.
In situations like this, which can happen during migrations, or just when we have the original structure in some other site for whatever reason, the UI version of the Menu Export module won’t work.
However, I found a solution!
Here’s the explanation on how to do it with the Structure Sync module: https://www.drupal.org/project/structure_sync/issues/2957187
It involves two steps to export, and two steps to import. Apparently the first step puts some configuration info on the DB, and the second step creates a file from that configuration, so it can be copied over to the target site, and be imported by applying the same steps in inverse order. Summing up:
- Drush in source site:
> drush export-all
> drush config-export
structure_sync.data.yml file to the target site
Drush in target site:
> drush config-import
> drush import-all
In my case I needed to ‘hack’ the exported menu to make the UUID match the target one, so I exported the target menu first to find out this value. It worked like a charm.
Hope this is useful!
Note: the Structure Sync module has to be configured to export just the menu, otherwise lots of other stuff will be exported and imported.
Nice, I am glad that work!! By the way using drush is possible to import only the configuration that you need, for example “drush migrate-import upgrade_d7_user_role”.
I used it to migrate only what I need from my D7 site.
You need also to insert in your settings.php available in your docker site using vi
$databases[‘migrate’][‘default’] = array (
‘database’ => ‘collaboration_7’,
‘username’ => 'User_nasme with admin privilege ',
‘password’ => ‘password’,
‘prefix’ => ‘’,
‘host’ => ‘host.cern.ch’,
‘port’ => ‘3306’,
‘namespace’ => ‘Drupal\Core\Database\Driver\mysql’,
‘driver’ => ‘mysql’,
$databases[‘upgrade’][‘default’] = $databases[‘migrate’][‘default’];
check this link to complement this tip https://drupalize.me/blog/201604/custom-drupal-drupal-migrations-migrate-tools
Provably you know about it bat could help to other users in the forum. I am still understanding all the steps of the migration
Just for extra information:
When using the ‘Single import’ option from ‘Configuration synchronization’ (under the admin menu ‘Configuration > Development’) to import a Menu as ‘Configuration type’, you can get this error message:
The configuration cannot be imported because it failed validation for the following reasons:
- Configuration simple_sitemap.bundle_settings.node.landing_page depends on the simple_sitemap extension that will not be installed after import.
This can be fixed by installing the ‘Simple XML Sitemap’ module (https://www.drupal.org/project/simple_sitemap).
Just in case someone is fiddling about configuration import/export, this can be useful