RoleInterface

Provides an interface defining a user role entity. Hierarchy interface \Drupal\Core\Entity\EntityInterface; interface \Drupal\Core\Config\Entity\ThirdPartySettingsInterfaceinterface \Drupal\Core\Config\Entity\ConfigEntityInterfaceinterface \Drupal\user\RoleInterface Related topics User accounts, permissions, and roles API for user accounts, access checking, roles, and permissions. File core/modules/user/src/RoleInterface.php, line 13 Namespace Drupal\user Members Name Modifiers

RoleForm::save

public RoleForm::save(array $form, FormStateInterface $form_state) Form submission handler for the 'save' action. Normally this method should be overridden to provide specific messages to the user and redirect the form after the entity has been saved. Parameters array $form: An associative array containing the structure of the form. \Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Return value int Either SAVED_NEW or SAVED_UPDATED, depending on the operation pe

RoleForm::form

public RoleForm::form(array $form, FormStateInterface $form_state) Gets the actual form array to be built. Overrides EntityForm::form See also \Drupal\Core\Entity\EntityForm::processForm() \Drupal\Core\Entity\EntityForm::afterBuild() File core/modules/user/src/RoleForm.php, line 16 Class RoleForm Form controller for the role entity edit forms. Namespace Drupal\user Code public function form(array $form, FormStateInterface $form_state) { $entity = $this->entity; $form['label'] =

RoleForm

Form controller for the role entity edit forms. Hierarchy class \Drupal\Core\Form\FormBase implements ContainerInjectionInterface, FormInterface uses DependencySerializationTrait, LoggerChannelTrait, LinkGeneratorTrait, RedirectDestinationTrait, UrlGeneratorTrait, StringTranslationTraitclass \Drupal\Core\Entity\EntityForm implements EntityFormInterfaceclass \Drupal\user\RoleForm File core/modules/user/src/RoleForm.php, line 11 Namespace Drupal\user Members Name Modifiers Type

RoleAccessControlHandler::checkAccess

protected RoleAccessControlHandler::checkAccess(EntityInterface $entity, $operation, AccountInterface $account) Performs access checks. This method is supposed to be overwritten by extending classes that do their own custom access checking. Parameters \Drupal\Core\Entity\EntityInterface $entity: The entity for which to check access. string $operation: The entity operation. Usually one of 'view', 'view label', 'update' or 'delete'. \Drupal\Core\Session\AccountInterface $account: The user for wh

RoleAccessControlHandler

Defines the access control handler for the user role entity type. Hierarchy class \Drupal\Core\Entity\EntityHandlerBase uses DependencySerializationTrait, StringTranslationTraitclass \Drupal\Core\Entity\EntityAccessControlHandler implements EntityAccessControlHandlerInterfaceclass \Drupal\user\RoleAccessControlHandler See also \Drupal\user\Entity\Role File core/modules/user/src/RoleAccessControlHandler.php, line 15 Namespace Drupal\user Members Name Modifiers Type Description

Role::setWeight

public Role::setWeight($weight) Sets the weight to the given value. Parameters int $weight: The desired weight. Return value $this Overrides RoleInterface::setWeight File core/modules/user/src/Entity/Role.php, line 104 Class Role Defines the user role entity class. Namespace Drupal\user\Entity Code public function setWeight($weight) { $this->set('weight', $weight); return $this; }

Role::setIsAdmin

public Role::setIsAdmin($is_admin) Sets the role to be an admin role. Parameters bool $is_admin: TRUE if the role should be an admin role. Return value $this Overrides RoleInterface::setIsAdmin File core/modules/user/src/Entity/Role.php, line 153 Class Role Defines the user role entity class. Namespace Drupal\user\Entity Code public function setIsAdmin($is_admin) { $this->is_admin = $is_admin; return $this; }

Role::revokePermission

public Role::revokePermission($permission) Revokes a permissions from the user role. Parameters string $permission: The permission to revoke. Return value $this Overrides RoleInterface::revokePermission File core/modules/user/src/Entity/Role.php, line 135 Class Role Defines the user role entity class. Namespace Drupal\user\Entity Code public function revokePermission($permission) { if ($this->isAdmin()) { return $this; } $this->permissions = array_diff($this->permi

Role::preSave

public Role::preSave(EntityStorageInterface $storage) Acts on an entity before the presave hook is invoked. Used before the entity is saved and before invoking the presave hook. Note that in case of translatable content entities this callback is only fired on their current translation. It is up to the developer to iterate over all translations if needed. This is different from its counterpart in the Field API, FieldItemListInterface::preSave(), which is fired on all field translations automatic