public function ChangeUserRoleBase::form

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

array $form_state: An associative array containing the current state of the form.

Return value

array The form structure.

Overrides ConfigurableActionInterface::form

File

drupal/core/modules/user/lib/Drupal/user/Plugin/Action/ChangeUserRoleBase.php, line 29
Contains \Drupal\user\Plugin\Action\ChangeUserRoleBase.

Class

ChangeUserRoleBase
Provides a base class for operations to change a user's role.

Namespace

Drupal\user\Plugin\Action

Code

public function form(array $form, array &$form_state) {
  $roles = user_role_names(TRUE);
  unset($roles[DRUPAL_AUTHENTICATED_RID]);
  $form['rid'] = array(
    '#type' => 'radios',
    '#title' => t('Role'),
    '#options' => $roles,
    '#default_value' => $this->configuration['rid'],
    '#required' => TRUE,
  );
  return $form;
}