1 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
- core/
modules/ user/ user.theme.inc, line 214 - Theme functions for the User module.
Code
function theme_user_admin_roles($variables) {
$form = $variables['form'];
$header = array(
array('data' => t('Name'), 'class' => array('role-name')),
array(
'data' => t('Description'),
'class' => array('role-description', 'priority-low'),
),
array('data' => t('Weight')),
array('data' => t('Operations'), 'class' => array('role-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[] = array(
'data' => theme('label_machine_name__role', array(
'label' => $label,
'machine_name' => $form['roles'][$role_name]['#role']->name,
)),
'class' => array('role-name'),
);
$row[] = array(
'data' => filter_xss_admin($form['roles'][$role_name]['#role']->description),
'class' => array('role-description', 'priority-low'),
);
$row[] = array(
'data' => backdrop_render($form['roles'][$role_name]['weight']),
);
$row[] = array(
'data' => backdrop_render($form['roles'][$role_name]['operations']),
'class' => array('role-operations'),
);
$rows[] = array('data' => $row, 'class' => array('draggable'));
}
backdrop_add_tabledrag('user-roles', 'order', 'sibling', 'role-weight');
$output = backdrop_render($form['roles_help']);
$output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'user-roles')));
$output .= backdrop_render_children($form);
return $output;
}