You are here

function menu_custom_features_export_render in Features 7

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

Implements 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) {
    $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[] = '';
  $code[] = '  return $menus;';
  $code = implode("\n", $code);
  return array(
    'menu_default_menu_custom' => $code,
  );
}