Newer
Older
<?php
namespace Drupal\user\Form;
Dries Buytaert
committed
use Drupal\Core\Form\FormStateInterface;
Alex Pott
committed
use Drupal\user\RoleInterface;
/**
* Provides the user permissions administration form for a specific role.
*/
class UserPermissionsRoleSpecificForm extends UserPermissionsForm {
/**
* The specific role for this form.
*
Alex Pott
committed
* @var \Drupal\user\RoleInterface
Alex Pott
committed
protected $userRole;
/**
* {@inheritdoc}
*/
protected function getRoles() {
return [$this->userRole->id() => $this->userRole];
* Builds the user permissions administration form for a specific role.
* @param array $form
* An associative array containing the structure of the form.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
* @param \Drupal\user\RoleInterface|null $user_role
* (optional) The user role used for this form. Defaults to NULL.
Dries Buytaert
committed
public function buildForm(array $form, FormStateInterface $form_state, RoleInterface $user_role = NULL) {
Alex Pott
committed
$this->userRole = $user_role;