You are here

function theme_nodeaccess_admin_form_roles in Nodeaccess 7

Same name and namespace in other branches
  1. 5 nodeaccess.module \theme_nodeaccess_admin_form_roles()
  2. 6.2 nodeaccess.module \theme_nodeaccess_admin_form_roles()
  3. 6 nodeaccess.module \theme_nodeaccess_admin_form_roles()

Theme function for nodeaccess_admin_form_roles.

Parameters

$variables:

Return value

string

Throws

Exception

1 theme call to theme_nodeaccess_admin_form_roles()
nodeaccess_admin_form in ./nodeaccess.admin.inc
Menu callback. Draws the admin page.

File

./nodeaccess.admin.inc, line 343
Nodeaccess admin forms.

Code

function theme_nodeaccess_admin_form_roles($variables) {
  $output = '';
  $form = $variables['form'];
  $rows = array();
  foreach (element_children($form) as $rid) {

    // Classify the weight element for TableDrag.
    $form[$rid]['weight']['#attributes']['class'] = array(
      'roles-order-weight',
    );

    // Mark the table row as draggable for TableDrag.
    $row = array(
      'data' => array(),
      'class' => array(
        'draggable',
      ),
    );

    // Render the table columns.
    $row['data'][] = drupal_render($form[$rid]['allow']);
    $row['data'][] = drupal_render($form[$rid]['alias']);
    $row['data'][] = drupal_render($form[$rid]['weight']);
    $rows[] = $row;
  }
  $header = array(
    t('Allow Role'),
    t('Alias'),
    t('Weight'),
  );
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => 'roles-order',
    ),
  ));
  $output .= drupal_render_children($form);

  // Attach TableDrag to the table ID and contained weight elements.
  drupal_add_tabledrag('roles-order', 'order', 'sibling', 'roles-order-weight');
  return $output;
}