function EntityOperations::entityPresave

Same name in this branch
  1. main core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityPresave()
Same name and namespace in other branches
  1. 11.x core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityPresave()
  2. 11.x core/modules/workspaces/src/Hook/EntityOperations.php \Drupal\workspaces\Hook\EntityOperations::entityPresave()
  3. 10 core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityPresave()
  4. 10 core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::entityPresave()
  5. 9 core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityPresave()
  6. 9 core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\EntityOperations::entityPresave()
  7. 8.9.x core/modules/content_moderation/src/EntityOperations.php \Drupal\content_moderation\EntityOperations::entityPresave()
  8. 8.9.x core/modules/workspaces/src/EntityOperations.php \Drupal\workspaces\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.