public function EntityTypeInfo::entityOperationAlter in Form mode manager 8.2
Same name and namespace in other branches
- 8 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
EntityListBuilderInterface::getOperations()
File
- src/
EntityTypeInfo.php, line 142
Class
- EntityTypeInfo
- Manipulates entity type information.
Namespace
Drupal\form_mode_managerCode
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;
}