1.20.x user.theme.inc | theme_user_admin_roles($variables) |
Returns HTML for the role order form.
Parameters
$variables: An associative array containing:
- form: A render element representing the form.
Related topics
File
- 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;
if (in_array($role_name, array(BACKDROP_ANONYMOUS_ROLE, BACKDROP_AUTHENTICATED_ROLE))) {
$label .= ' ' . t('(required)');
}
$row = array();
$row[] = theme('label_machine_name__role', array(
'label' => $label,
'machine_name' => $form['roles'][$role_name]['#role']->name,
));
$row[] = backdrop_render($form['roles'][$role_name]['weight']);
$row[] = backdrop_render($form['roles'][$role_name]['operations']);
$rows[] = array('data' => $row, 'class' => array('draggable'));
}
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;
}