You are here

function menu_links_configuration_export_render in Configuration Management 7

Implements hook_configuration_export_render()

2 calls to menu_links_configuration_export_render()
configuration_check_menu_links in includes/configuration.menu.inc
configuration_hash_menu_links in includes/configuration.menu.inc

File

includes/configuration.menu.inc, line 193

Code

function menu_links_configuration_export_render($module, $data) {
  $code = array();
  $code[] = '  $menu_links = array();';
  $code[] = '';
  $translatables = array();
  foreach ($data as $identifier) {
    if ($link = configuration_menu_link_load($identifier)) {

      // Replace plid with a parent path.
      if (!empty($link['plid']) && ($parent = menu_link_load($link['plid']))) {
        $link['parent_path'] = $parent['link_path'];
      }
      unset($link['plid']);
      unset($link['mlid']);
      $code[] = "  // Exported menu link: {$identifier}";
      $code[] = "  \$menu_links['{$identifier}'] = " . configuration_var_export($link, '  ') . ";";
      $translatables[] = $link['link_title'];
    }
  }
  if (!empty($translatables)) {
    $code[] = configuration_translatables_export($translatables, '  ');
  }
  $code[] = '';
  $code[] = '  return $menu_links;';
  $code = implode("\n", $code);
  return array(
    'menu_default_menu_links' => $code,
  );
}