You are here

function _menu_import_preview_row_recurse in Menu Export/Import 7

Recursive function for theming a menu item and its children.

1 call to _menu_import_preview_row_recurse()
menu_import_preview in includes/admin.inc
Renders the menu for preview.

File

includes/admin.inc, line 438
Administrative page callbacks for menu_import module.

Code

function _menu_import_preview_row_recurse(&$menu, $index, $level, $options) {
  $rows = array();
  $title = theme('indentation', array(
    'size' => $level,
  ));
  $title .= $menu[$index]['link_title'];
  $exists = $menu[$index]['nid'] ? t('Yes') : t('No');
  $weight = $menu[$index]['weight'];
  $path = !empty($menu[$index]['path']) ? $menu[$index]['path'] : ' - ';
  $link_path = !empty($menu[$index]['link_path']) ? $menu[$index]['link_path'] : ' - ';
  $description = isset($menu[$index]['description']) ? $menu[$index]['description'] : '';
  $row_data = array(
    array(
      'data' => '<span title="' . check_plain($description) . '">' . $title . '</span>',
    ),
    array(
      'data' => $exists,
    ),
    array(
      'data' => check_url($path),
    ),
    array(
      'data' => check_url($link_path),
    ),
  );
  $row_data[] = array(
    'data' => $weight,
  );
  $rows[] = array(
    'data' => $row_data,
  );
  foreach ($menu[$index]['children'] as $child) {
    $new_rows = _menu_import_preview_row_recurse($menu, $child, $level + 1, $options);
    foreach ($new_rows as $row) {
      $rows[] = $row;
    }
  }
  return $rows;
}