You are here

function theme_menu_breadcrumb_menus_table in Menu Breadcrumb 7

Same name and namespace in other branches
  1. 6 menu_breadcrumb.module \theme_menu_breadcrumb_menus_table()

Theme a drag-to-reorder table of menu selection checkboxes.

1 theme call to theme_menu_breadcrumb_menus_table()
menu_breadcrumb_admin_settings_form in ./menu_breadcrumb.module
Menu breadcrumb admin settings form.

File

./menu_breadcrumb.module, line 605
The main file for the menu_breadcrumb module.

Code

function theme_menu_breadcrumb_menus_table($variables) {
  $form = $variables['form'];
  drupal_add_tabledrag('menu-breadcrumb-menus', 'order', 'sibling', 'menu-weight');
  $table['attributes']['id'] = 'menu-breadcrumb-menus';
  $table['header'] = array(
    t('Menu'),
    t('Enabled'),
    t('Weight'),
  );

  // Generate table of draggable menu names.
  $rows = array();
  foreach (element_children($form) as $key) {
    if (isset($form[$key]['title_display'])) {
      $menu =& $form[$key];
      $row = array();
      $row[] = drupal_render($menu['title_display']);
      $row[] = drupal_render($menu['enabled']);
      $menu['weight']['#attributes']['class'] = array(
        'menu-weight',
      );
      $row[] = drupal_render($menu['weight']);
      $rows[] = array(
        'data' => $row,
        'class' => array(
          'draggable',
        ),
      );
    }
  }
  $table['rows'] = $rows;
  return theme('table', $table);
}