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.
13 class UserPermissionsRoleSpecificForm extends UserPermissionsForm {
16 * The specific role for this form.
18 * @var \Drupal\user\RoleInterface
25 protected function getRoles() {
26 return [$this->userRole->id() => $this->userRole];
30 * Builds the user permissions administration form for a specific role.
33 * An associative array containing the structure of the form.
34 * @param \Drupal\Core\Form\FormStateInterface $form_state
35 * The current state of the form.
36 * @param \Drupal\user\RoleInterface|null $user_role
37 * (optional) The user role used for this form. Defaults to NULL.
39 public function buildForm(array $form, FormStateInterface $form_state, RoleInterface $user_role = NULL) {
40 $this->userRole = $user_role;
41 return parent::buildForm($form, $form_state);