You are here

function theme_multiple_node_menu_table in Multiple Node Menu 6

1 theme call to theme_multiple_node_menu_table()
multiple_node_menu_form_alter in ./multiple_node_menu.module
Implementation of hook_form_alter()

File

./multiple_node_menu.module, line 297

Code

function theme_multiple_node_menu_table($form) {
  $headers = array(
    t(''),
    // Spacer
    t('Menu link title'),
    t('Parent Item'),
    t('Weight'),
    t('Enable'),
    t(''),
  );
  $rows = array(
    array(),
  );
  foreach (element_children($form) as $key) {

    // prevent printing field titles for every row
    unset($form[$key]['link_title']['#title'], $form[$key]['link_remove']['#title'], $form[$key]['link_mlid']['#title'], $form[$key]['link_enable']['#title'], $form[$key]['link_parent']['#title'], $form[$key]['link_weight']['#title']);

    // Build the table row.
    $form[$key]['link_weight']['#attributes']['class'] = 'multiple-menu-weight';
    $row = array(
      'data' => array(
        array(
          'style' => 'width: 40px;',
        ),
        array(
          'data' => drupal_render($form[$key]['link_title']),
          'class' => 'link-title',
        ),
        array(
          'data' => drupal_render($form[$key]['link_parent']),
          'class' => 'link-parent',
        ),
        array(
          'data' => drupal_render($form[$key]['link_weight']),
          'class' => 'link-weight',
        ),
        array(
          'data' => drupal_render($form[$key]['link_enable']),
          'class' => 'link-enable',
        ),
        array(
          'data' => drupal_render($form[$key]['link_remove']) . drupal_render($form[$key]['link_mlid']),
          'class' => 'remove-menu-link',
        ),
      ),
      'class' => 'draggable',
    );
    $rows[] = $row;
  }
  if (!$form['no_links']) {
    drupal_add_tabledrag('multiple-menu-table', 'order', 'sibling', 'multiple-menu-weight');
  }
  $output = theme('table', $headers, $rows, array(
    'id' => 'multiple-menu-table',
  ));
  $output .= drupal_render($form);
  return $output;
}