You are here

function theme_menu_position_rules_order in Menu Position 6

Same name and namespace in other branches
  1. 7.2 menu_position.admin.inc \theme_menu_position_rules_order()
  2. 7 menu_position.admin.inc \theme_menu_position_rules_order()

Returns HTML for the menu position rules form.

1 theme call to theme_menu_position_rules_order()
menu_position_rules_form in ./menu_position.admin.inc
Form definition: orders rules.

File

./menu_position.admin.inc, line 270
Provides infrequently used functions and hooks for menu_position.

Code

function theme_menu_position_rules_order($element) {
  drupal_add_tabledrag('menu-position-rules', 'order', 'sibling', 'rule-weight');
  $header = array(
    t('Rule'),
    t('Affected menu'),
    array(
      'data' => t('Enabled'),
      'class' => 'checkbox',
    ),
    t('Weight'),
    array(
      'data' => t('Operations'),
      'colspan' => '2',
    ),
  );
  $rows = array();
  $attributes = array(
    'id' => 'menu-position-rules',
  );

  // Generate table of draggable menu names.
  foreach (element_children($element) as $rule) {

    // Add special classes to be used for tabledrag.js.
    $element[$rule]['weight']['#attributes']['class'] = 'rule-weight';

    // Render the title, enabled, and weight columns.
    $data = array(
      drupal_render($element[$rule]['title']),
      drupal_render($element[$rule]['menu_name']),
      array(
        'data' => drupal_render($element[$rule]['enabled']),
        'class' => 'checkbox menu-enabled',
      ),
      drupal_render($element[$rule]['weight']),
    );

    // Render the operations links.
    foreach (element_children($element[$rule]['operations']) as $op) {
      $data[] = array(
        'data' => drupal_render($element[$rule]['operations'][$op]),
        'class' => 'menu-operations',
      );
    }
    $rows[] = array(
      'data' => $data,
      'class' => 'draggable',
    );
  }
  return theme('table', $header, $rows, $attributes);
}