You are here

function role_expire_form_user_admin_role_alter in Role Expire 7

Same name and namespace in other branches
  1. 6 role_expire.module \role_expire_form_user_admin_role_alter()

Implements hook_form_FORM-ID_alter().

File

./role_expire.module, line 317
Role Expire module

Code

function role_expire_form_user_admin_role_alter(&$form, $form_state) {
  $form['role_expire'] = array(
    '#title' => t("Default duration for the role %role", array(
      '%role' => drupal_ucfirst($form['name']['#default_value']),
    )),
    '#type' => 'textfield',
    '#size' => 10,
    '#default_value' => role_expire_get_default_duration($form['rid']['#value']),
    '#maxlength' => 32,
    '#attributes' => array(
      'class' => array(
        'role-expire-role-expiry',
      ),
    ),
    '#description' => t('Enter the time span you want to set as the default duration for this role. Examples: 12 hours, 1 day, 3 days, 4 weeks, 3 months, 1 year. Leave blank for no default duration. (If you speak php, this value may be any !l-compatible relative form.)', array(
      '!l' => l('strtotime', 'http://php.net/manual/en/function.strtotime.php'),
    )),
  );

  // Reposition the submit button and delete.
  $form['submit']['#weight'] = 2;
  if (arg(4)) {
    $form['delete']['#weight'] = 3;
  }
  $form['#validate'][] = 'role_expire_user_admin_role_validate';
  $form['#submit'][] = 'role_expire_user_admin_role_submit';
}