1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
TaskPresaveBlocksHistory.php
См. документацию.
1<?php
2declare(strict_types=1);
3
4namespace Bitrix\Landing\Copilot\Generation\Step;
5
6use Bitrix\Landing\Copilot\Generation\GenerationException;
7use Bitrix\Landing\History;
8use Bitrix\Landing\Rights;
9
11{
12 public const DATA_KEY = 'blocks_contents_before';
13
20 public function execute(): bool
21 {
22 parent::execute();
23
25 $historyState = History::isActive();
26 History::deactivate();
27
28 $blockContents = $this->getBlockContents();
29 if (!empty($blockContents))
30 {
31 $this->generation->setData(self::DATA_KEY, $blockContents);
32 }
33
35 if ($historyState)
36 {
37 History::activate();
38 }
39
40 return true;
41 }
42
43 private function getBlockContents(): array
44 {
45 $blockContents = [];
46
47 $landing = $this->siteData->getLandingInstance();
48 if (!$landing)
49 {
50 return $blockContents;
51 }
52
53 foreach ($this->siteData->getBlocks() as $blockData)
54 {
55 $blockId = $blockData->getId();
56 if (!$blockId || $blockId <= 0)
57 {
58 continue;
59 }
60
61 $block = $landing->getBlockById($blockId);
62 if (!$block)
63 {
64 continue;
65 }
66
67 $blockContents[$blockId] = $block->getContent();
68 }
69
70 return $blockContents;
71 }
72}
static setGlobalOn()
Определения rights.php:116
static setGlobalOff()
Определения rights.php:107
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804