You are here

function menu_links_configuration_export in Configuration Management 7

Implements hook_configuration_export().

File

includes/configuration.menu.inc, line 162

Code

function menu_links_configuration_export($data, &$export, $module_name = '') {

  // Default hooks are provided by the feature module so we need to add
  // it as a dependency.
  $export['dependencies']['configuration'] = 'configuration';
  $export['dependencies']['menu'] = 'menu';

  // Collect a link to module map
  $pipe = array();
  $map = configuration_get_default_map('menu_links', 'menu_links_configuration_identifier');
  foreach ($data as $identifier) {
    if ($link = configuration_menu_link_load($identifier)) {

      // If this link is provided by a different module, add it as a dependency.
      if (isset($map[$identifier]) && $map[$identifier] != $module_name) {
        $export['dependencies'][$map[$identifier]] = $map[$identifier];
      }
      $export['configuration']['menu_links'][$identifier] = $identifier;

      // For now, exclude a variety of common menus from automatic export.
      // They may still be explicitly included in a Feature if the builder
      // chooses to do so.
      if (!in_array($link['menu_name'], array(
        'configuration',
        'primary-links',
        'secondary-links',
        'navigation',
        'admin',
        'devel',
      ))) {
        $pipe['menu_custom'][] = $link['menu_name'];
      }
    }
  }
  return $pipe;
}