1 user.admin.inc user_admin_role($form, &$form_state, $role)

Form to configure a single role.

See also

user_admin_role_submit()

Related topics

File

core/modules/user/user.admin.inc, line 664
Admin page callback file for the user module.

Code

function user_admin_role($form, &$form_state, $role) {
  $form_state['role'] = $role;

  $form['label'] = array(
    '#type' => 'textfield',
    '#title' => t('Role name'),
    '#default_value' => $role->label,
    '#size' => 30,
    '#required' => TRUE,
    '#maxlength' => 64,
    '#description' => t('The name for this role. Example: "moderator", "editorial board", "site architect".'),
  );
  $form['name'] = array(
    '#type' => 'machine_name',
    '#size' => 32,
    '#maxlength' => 64,
    '#default_value' => $role->name,
    '#disabled' => TRUE,
    '#machine_name' => array(
      'exists' => 'user_role_load',
    ),
    '#description' => t('A unique machine-readable name for this role. It must only contain lowercase letters, numbers, and underscores.'),
  );
  $form['weight'] = array(
    '#type' => 'value',
    '#value' => $role->weight,
  );
  $form['actions'] = array('#type' => 'actions');
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save role'),
  );

  return $form;
}