I have exported a menu hierarchy into sites/all/config
I'm finding that some items lose their parent information when I do a fresh reinstall of drupal, change the config directory and then click syncronize. I've checked in the files and they get overwritten. Any ideas?

This is the error I'm getting as well:

Notice: Undefined index: menu_name in Drupal\configuration\Config\MenuConfiguration::alterDependencies() (line 62 of /Applications/XAMPP/xamppfiles/htdocs/stat/sites/all/modules/contrib/configuration/lib/Drupal/configuration/Config/MenuConfiguration.php).

Comments

bjalford’s picture

I'm wondering whether it's similar to http://drupal.org/node/1866966 in terms of the parent menu items not existing when importing the child items?

GDrupal’s picture

@bjalford thanks for submit this.. i think that http://drupal.org/node/1866966 it's very different in that case panelizer is creating a set of permission dynamically for each content type.. and somehow it does not update during the import process. You could be right about that menu missing so menu link can not be pointed, but not sure. Still looking into this.

bjalford’s picture

I've got some clear replication steps

Clean Drupal 7.18 install with xautoload 2.7 and latest dev of configuration

1) Create directory with 777 permissions as sites/all/config

2) Through UI, create nodes as basic pages with menu items
node/1 - parent is main-menu
node/2 - parent is main-menu
node/3 - parent is node/1 menu item
node/4 - parent is node/1 menu item
node/5 - parent is node/2 menu item

3) Go to configuration management and set path to sites/all/config

4) Go to not tracking and select all the menu items for main-menu including Home, click start tracking button

5) drop db, reset settings.php

6) Run installation, then create 5 nodes without menu items

7) Enable conf management and set path to sites/all/config

8) Click syncronize

9) Menu will now be:
node/5
Home
node/1
-node/3
-node/4
node/2

node/1 and submenu items correct, node/2 correct but node/5 menu item in wrong place, should be under node/2

bjalford’s picture

removed duplicate post

GDrupal’s picture

@bjalford thanks for taking the time of clarifying this.. 1 more question.... This issue apears when you export and import configurations using a tar file? can you confirm that?

GDrupal’s picture

@bjalford Another question are you creating the menu entries from Node edit form.. or the menu module UI?

GDrupal’s picture

Confirmed this issue only appears when synchronizing, export and import menu and menu-links works correctly.

bjalford’s picture

Seen the same myself. Just when doing the sync. I'd tried to find an issue in code but nothing yet...

GDrupal’s picture

@bjalford Both processes use basically the same api method ConfigurationManagement::importToActiveStore() the problem as far I see go around dependencies... if you import including dependencies it will work... and fail if you don't include them, the way that method imports dependent components it's kind a different as importing single components 1 by 1. I do not have time to look for this issue right now but let me know if you are working on this and I can assist you, i'm in the IRC.

dagmar’s picture

dagmar’s picture

Status: Active » Closed (cannot reproduce)

I cannot replicate this issue using the last development version after the commit mentioned above. Please re-open if you still are having issues.

rylowry@gmail.com’s picture

I'm having the same problem. According to drush I'm using 7.x-2.0-alpha2+10-dev. I'm trying to copy the data store to the active store inside an install profile. The data store includes an exported menu and menu links. I have dependencies set to TRUE, but some of the links fail to appear, and I see notices identical to the one in the summary.

From the install profile:

  $tracking_file = \Drupal\configuration\Config\ConfigurationManagement::readTrackingFile();
  $to_track = array_keys($tracking_file['tracked']);
  \Drupal\configuration\Config\ConfigurationManagement::importToActiveStore($to_track, TRUE, FALSE, TRUE);

I'm still digging, hopefully I'll be able to provide some more information.

GDrupal’s picture

@rylowry We were using configuration to manage configuration in a install profile from quite a time using the function configuration_import_directory(). You have a lot of parameters to handling the import check the function definition in configuration.module. This helper function allow you to do a few extra things like enabling modules and other stuff.

This is a callback example that you can use for a profile task, here we keep the files in a configuration folder within the profile:


function my_profile_import_configurations_process() {
  if (module_exists('configuration')) {
    $config_path = drupal_get_path('profile', 'my_profile') . "/configuration/";
    configuration_import_directory($config_path);
    drupal_set_message("Imported configurations");
  }
  else {
    drupal_set_message("Error importing configurations.", 'Error');
  }
}
dazweeja’s picture

If it helps with debugging this issue, I'm also seeing similar behaviour but only with menu links that link to views. If I create links manually with the normal Drupal menu UI and the path links to the path of a View, the menu link will not be created when synchronizing. If I create an identical link but using the 'Menu' section on the edit page for the relevant View, the menu link will be created. Both types of links function identically in the 'source' Drupal site, but only the latter type can be imported during synchronization.

dazweeja’s picture

Issue summary: View changes

update