You are here

function duplicate_role_form in Duplicate role 6

Same name and namespace in other branches
  1. 6.2 duplicate_role.module \duplicate_role_form()
  2. 7 duplicate_role.module \duplicate_role_form()

Module selection interface.

1 string reference to 'duplicate_role_form'
duplicate_role_menu in ./duplicate_role.module
Implementation of hook_menu().

File

./duplicate_role.module, line 111

Code

function duplicate_role_form() {
  $form = array();
  $u_roles = user_roles();
  asort($u_roles);
  $options = array();
  $options[] = t('-- Please Select One --');
  foreach ($u_roles as $key => $value) {
    $options[$key] = $value;
  }
  $form['copiarol']['varid'] = array(
    '#type' => 'select',
    '#title' => t('Choose role to duplicate'),
    '#default_value' => variable_get('copiarol_varid', 0),
    '#description' => t("Select role to duplicate"),
    '#options' => $options,
  );
  $form['copiarol']['nome'] = array(
    '#type' => 'textfield',
    '#title' => t('New role'),
    '#default_value' => variable_get('copiarol_nome', ''),
    '#required' => true,
    '#size' => 40,
    '#maxlength' => 40,
    '#description' => t("Name for the new role"),
  );
  $form['copiarol']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Create new role'),
  );
  return $form;
}