You are here

public function ChangeUserRoleTrait::buildConfigurationForm in Administer Users by Role 8.3

File

src/Plugin/Action/ChangeUserRoleTrait.php, line 26

Class

ChangeUserRoleTrait
Common overrides for AddRoleUser and RemoveRoleUser.

Namespace

Drupal\administerusersbyrole\Plugin\Action

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildConfigurationForm($form, $form_state);
  $allowed = \Drupal::service('administerusersbyrole.access')
    ->listRoles('role-assign', \Drupal::currentUser());
  $form['rid']['#options'] = array_intersect_key($form['rid']['#options'], array_flip($allowed));
  return $form;
}