3 namespace Drupal\user\Form;
5 use Drupal\Core\Form\FormStateInterface;
6 use Drupal\user\RoleInterface;
9 * Provides the user permissions administration form for a specific role.
11 class UserPermissionsRoleSpecificForm extends UserPermissionsForm {
14 * The specific role for this form.
16 * @var \Drupal\user\RoleInterface
23 protected function getRoles() {
24 return [$this->userRole->id() => $this->userRole];
28 * Builds the user permissions administration form for a specific role.
31 * An associative array containing the structure of the form.
32 * @param \Drupal\Core\Form\FormStateInterface $form_state
33 * The current state of the form.
34 * @param \Drupal\user\RoleInterface|null $user_role
35 * (optional) The user role used for this form. Defaults to NULL.
37 public function buildForm(array $form, FormStateInterface $form_state, RoleInterface $user_role = NULL) {
38 $this->userRole = $user_role;
39 return parent::buildForm($form, $form_state);