Provides a base class for operations to change a user's role.
Expanded class hierarchy of ChangeUserRoleBase
abstract class ChangeUserRoleBase extends ConfigurableActionBase {
/**
* {@inheritdoc}
*/
protected function getDefaultConfiguration() {
return array(
'rid' => '',
);
}
/**
* {@inheritdoc}
*/
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;
}
/**
* {@inheritdoc}
*/
public function submit(array &$form, array &$form_state) {
$this->configuration['rid'] = $form_state['values']['rid'];
}
}