You are here

function theme_menu_position_rules_order in Menu Position 7.2

Same name and namespace in other branches
  1. 6 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 253
Provides infrequently used functions and hooks for menu_position.

Code

function theme_menu_position_rules_order($variables) {
  $element = $variables['element'];
  drupal_add_tabledrag('menu-position-rules', 'order', 'sibling', 'rule-weight');
  $variables = array(
    'header' => array(
      t('Rule'),
      t('Affected menu'),
      array(
        'data' => t('Enabled'),
        'class' => array(
          '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'] = array(
      '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' => array(
          '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' => array(
          'menu-operations',
        ),
      );
    }
    $variables['rows'][] = array(
      'data' => $data,
      'class' => array(
        'draggable',
      ),
    );
  }
  return theme('table', $variables);
}