function WorkspaceAssociation::onPostPublish
Same name in other branches
- 10 core/modules/workspaces/src/WorkspaceAssociation.php \Drupal\workspaces\WorkspaceAssociation::onPostPublish()
Triggers clean-up operations after a workspace is published.
Parameters
\Drupal\workspaces\Event\WorkspacePublishEvent $event: The workspace publish event.
File
-
core/
modules/ workspaces/ src/ WorkspaceAssociation.php, line 393
Class
- WorkspaceAssociation
- Provides a class for CRUD operations on workspace associations.
Namespace
Drupal\workspacesCode
public function onPostPublish(WorkspacePublishEvent $event) : void {
// Cleanup associations for the published workspace as well as its
// descendants.
$affected_workspaces = $this->workspaceRepository
->getDescendantsAndSelf($event->getWorkspace()
->id());
foreach ($affected_workspaces as $workspace_id) {
$this->deleteAssociations($workspace_id);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.