You are here

public function EntityTypeInfo::grantAccessToEditOperation in Form mode manager 8

Same name and namespace in other branches
  1. 8.2 src/EntityTypeInfo.php \Drupal\form_mode_manager\EntityTypeInfo::grantAccessToEditOperation()

Evaluate if current user has access to "edit" operations.

Parameters

array $operations: Operations array as returned by getOperations().

\Drupal\Core\Entity\EntityInterface $entity: The entity on which to define an operation.

Return value

bool TRUE if user have access to default edit button, if not FALSE.

See also

entityOperationAlter()

1 call to EntityTypeInfo::grantAccessToEditOperation()
EntityTypeInfo::entityOperationAlter in src/EntityTypeInfo.php
Take control of default operations.

File

src/EntityTypeInfo.php, line 164

Class

EntityTypeInfo
Manipulates entity type information.

Namespace

Drupal\form_mode_manager

Code

public function grantAccessToEditOperation($operations, EntityInterface $entity) {
  return isset($operations['edit']) && !$this->currentUser
    ->hasPermission("use {$entity->getEntityTypeId()}.default form mode");
}