You are here

function theme_power_menu_plugins_order in Power Menu 7.2

Returns HTML for the power menu plugins order form.

1 theme call to theme_power_menu_plugins_order()
power_menu_configuration_form in ./power_menu.admin.inc
Form definition for Powe Menu configuration.

File

./power_menu.admin.inc, line 161
This contains all the admin stuff of the module

Code

function theme_power_menu_plugins_order($variables) {
  $element = $variables['element'];
  drupal_add_tabledrag('power-menu-plugins', 'order', 'sibling', 'plugin-weight');
  $variables = array(
    'header' => array(
      t('Handlers'),
      t('Description'),
      array(
        'data' => t('Enabled'),
        'class' => array(
          'checkbox',
        ),
      ),
      array(
        'data' => t('Operations'),
      ),
      t('Weight'),
    ),
    'rows' => array(),
    'attributes' => array(
      'id' => 'power-menu-plugins',
    ),
  );

  // 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(
      'plugin-weight',
    );

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

    // 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',
        ),
      );
    }
    $data[] = drupal_render($element[$rule]['weight']);
    $variables['rows'][] = array(
      'data' => $data,
      'class' => array(
        'draggable',
      ),
    );
  }
  return theme('table', $variables);
}