You are here

public function EntityTypeInfo::entityOperationAlter in Form mode manager 8

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

Take control of default 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

array An array of operation definitions.

See also

hook_entity_operation_alter()

EntityListBuilderInterface::getOperations()()

File

src/EntityTypeInfo.php, line 140

Class

EntityTypeInfo
Manipulates entity type information.

Namespace

Drupal\form_mode_manager

Code

public function entityOperationAlter(array &$operations, EntityInterface $entity) {
  if (empty($this->formModeManager
    ->getFormModesByEntity($entity
    ->getEntityTypeId()))) {
    return $operations;
  }
  elseif ($this
    ->grantAccessToEditOperation($operations, $entity)) {
    unset($operations['edit']);
  }
  return $operations;
}