18 public function execute(
bool $undo =
true): bool
21 if ($landing->exist())
23 foreach ($landing->getBlocks() as $block)
25 $accessBefore = $block->getAccess();
26 $block->setAccess(Block::ACCESS_X);
28 $landing->markDeletedBlock($block->getId(),
true);
30 $block->setAccess($accessBefore);
34 $blocksToUndelete = $undo ? $this->params[
'blocksBefore'] : $this->params[
'blocksAfter'];
35 foreach ($blocksToUndelete as $blockId)
37 $block =
new Block($blockId);
38 $accessBefore = $block->getAccess();
39 $block->setAccess(Block::ACCESS_X);
40 $landing->addBlockToCollection($block);
42 $landing->markDeletedBlock($blockId,
false);
44 $block->setAccess($accessBefore);
48 $fields = $undo ? $this->params[
'additionalFieldsBefore'] : $this->params[
'additionalFieldsAfter'];
53 && $landing->getError()->isEmpty()
56 $landing->publication();