function EntityOperations::entityPresave

Implements hook_entity_presave().

Attributes

#[Hook('entity_presave', order: Order::First)] #[ReorderHook('entity_presave', class: ContentModerationHooks::class, method: 'entityPresave', order: new OrderBefore([ 'workspaces', ]))]

File

core/modules/workspaces/src/Hook/EntityOperations.php, line 52

Class

EntityOperations
Defines a class for reacting to entity runtime hooks.

Namespace

Drupal\workspaces\Hook

Code

public function entityPresave(EntityInterface $entity) : void {
  if ($this->workspaceInfo
    ->isEntityIgnored($entity)) {
    return;
  }
  $this->workspaceManager
    ->getActiveWorkspace()?->getProvider()
    ->entityPresave($entity);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.