You are here

function menu_custom_features_export_render in Features 6

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

Implementation of hook_features_export_render()

File

includes/features.menu.inc, line 82

Code

function menu_custom_features_export_render($module, $data) {
  $code = array();
  $code[] = '  $menus = array();';
  $code[] = '';
  $translatables = array();
  foreach ($data as $menu_name) {
    $result = db_query("SELECT menu_name, title, description FROM {menu_custom} WHERE menu_name = '%s'", $menu_name);
    while ($row = db_fetch_array($result)) {
      $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[] = '';
  $code[] = '  return $menus;';
  $code = implode("\n", $code);
  return array(
    'menu_default_menu_custom' => $code,
  );
}