1 user.theme.inc theme_user_admin_roles($variables)

Returns HTML for the role order and new role form.

Parameters

$variables: An associative array containing:

  • form: A render element representing the form.

Related topics

File

core/modules/user/user.theme.inc, line 172
Theme functions for the User module.

Code

function theme_user_admin_roles($variables) {
  $form = $variables['form'];

  $header = array(t('Name'), t('Weight'), t('Operations'));
  foreach (element_children($form['roles']) as $role_name) {
    $label = $form['roles'][$role_name]['#role']->label;
    $row = array();
    if (in_array($role_name, array(BACKDROP_ANONYMOUS_ROLE, BACKDROP_AUTHENTICATED_ROLE))) {
      $row[] = t('@name <em>(required)</em>', array('@name' => $label));
    }
    else {
      $row[] = check_plain($label);
    }
    $row[] = backdrop_render($form['roles'][$role_name]['weight']);
    $row[] = backdrop_render($form['roles'][$role_name]['operations']);
    $rows[] = array('data' => $row, 'class' => array('draggable'));
  }
  $row = array();
  $row[] = array('data' => backdrop_render($form['label']) . backdrop_render($form['name']), 'class' => 'edit-name');
  $row[] = '';
  $row[] = backdrop_render($form['add']);
  $rows[] = $row;

  backdrop_add_tabledrag('user-roles', 'order', 'sibling', 'role-weight');

  $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'user-roles')));
  $output .= backdrop_render_children($form);

  return $output;
}