nodeStorage = $entityTypeManager->getStorage('node'); } /** * Implements hook_user_cancel(). * * Unpublish nodes (current revisions). */ #[Hook('user_cancel')] public function userCancelBlockUnpublish($edit, UserInterface $account, $method): void { if ($method === 'user_cancel_block_unpublish') { $nids = $this->nodeStorage->getQuery() ->accessCheck(FALSE) ->condition('uid', $account->id()) ->execute(); $this->moduleHandler->invoke('node', 'mass_update', [$nids, ['status' => 0], NULL, TRUE]); } } /** * Implements hook_user_cancel(). * * Anonymize all of the nodes for this old account. */ #[Hook('user_cancel')] public function userCancelReassign($edit, UserInterface $account, $method): void { if ($method === 'user_cancel_reassign') { $vids = $this->nodeStorage->userRevisionIds($account); $this->moduleHandler->invoke('node', 'mass_update', [$vids, ['uid' => 0, 'revision_uid' => 0], NULL, TRUE, TRUE]); } } /** * Implements hook_block_alter(). */ #[Hook('block_alter')] public function blockAlter(&$definitions): void { // Hide the deprecated Syndicate block from the UI. $definitions['node_syndicate_block']['_block_ui_hidden'] = TRUE; } }