You are here

function menu_custom_features_export_render in Features 7.2

Same name and namespace in other branches
  1. 6 includes/features.menu.inc \menu_custom_features_export_render()
  2. 7 includes/features.menu.inc \menu_custom_features_export_render()

Implements hook_features_export_render().

File

includes/features.menu.inc, line 94
Features integration for 'menu' module.

Code

function menu_custom_features_export_render($module, $data) {
  $code = array();
  $code[] = '  $menus = array();';
  $code[] = '';
  $translatables = array();
  foreach ($data as $menu_name) {
    $row = db_select('menu_custom')
      ->fields('menu_custom')
      ->condition('menu_name', $menu_name)
      ->execute()
      ->fetchAssoc();
    if ($row) {
      $export = features_var_export($row, '  ');
      $code[] = "  // Exported menu: {$menu_name}.";
      $code[] = "  \$menus['{$menu_name}'] = {$export};";
      $translatables[] = $row['title'];
      $translatables[] = $row['description'];
    }
  }
  if (!empty($translatables)) {
    $code[] = features_translatables_export($translatables, '  ');
  }
  $code[] = '  return $menus;';
  $code = implode("\n", $code);

  /* @see \hook_menu_default_menu_custom() */
  return array(
    'menu_default_menu_custom' => $code,
  );
}