user_admin_roles
function user_admin_roles
user_admin_roles($form, $form_state)
Form to re-order roles or add a new one.
See also
Related topics
File
- modules/user/user.admin.inc, line 844
- Admin page callback file for the user module.
Code
function user_admin_roles($form, $form_state) { $roles = user_roles(); $form['roles'] = array( '#tree' => TRUE, ); $order = 0; foreach ($roles as $rid => $name) { $form['roles'][$rid]['#role'] = (object) array( 'rid' => $rid, 'name' => $name, 'weight' => $order, ); $form['roles'][$rid]['#weight'] = $order; $form['roles'][$rid]['weight'] = array( '#type' => 'textfield', '#title' => t('Weight for @title', array('@title' => $name)), '#title_display' => 'invisible', '#size' => 4, '#default_value' => $order, '#attributes' => array('class' => array('role-weight')), ); $order++; } $form['name'] = array( '#type' => 'textfield', '#title' => t('Name'), '#title_display' => 'invisible', '#size' => 32, '#maxlength' => 64, ); $form['add'] = array( '#type' => 'submit', '#value' => t('Add role'), '#validate' => array('user_admin_role_validate'), '#submit' => array('user_admin_role_submit'), ); $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save order'), '#submit' => array('user_admin_roles_order_submit'), ); return $form; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!user!user.admin.inc/function/user_admin_roles/7.x