4use \Bitrix\Landing\Manager;
5use \Bitrix\Landing\Rights;
6use \Bitrix\Landing\Site;
7use \Bitrix\Landing\Landing;
8use \Bitrix\Landing\File;
22 'code' =>
'27.2.one_col_full_title',
23 'selector' =>
'.landing-block-node-title'
26 'code' =>
'27.6.one_col_fix_text_with_headings',
27 'selector' =>
'.landing-block-node-text'
30 'code' =>
'27.5.one_col_fix_text_with_border',
31 'selector' =>
'.landing-block-node-text'
34 'code' =>
'27.7.one_col_fix_text_on_bg',
35 'selector' =>
'.landing-block-node-text'
38 'code' =>
'32.2.img_one_big',
39 'selector' =>
'.landing-block-node-img'
42 'code' =>
'27.6.one_col_fix_text_with_headings',
43 'selector' =>
'.landing-block-node-text'
46 'code' =>
'49.1.video_just_video',
47 'selector' =>
'.landing-block-node-embed'
58 return self::BLOCKS[$type] ??
null;
67 $res = Site::getList([
78 while ($row = $res->fetch())
100 public static function createFromSource(
int $kbId,
string $sourceType,
int $sourceId): ?array
102 if (in_array($sourceType, self::AVAILABLE_SOURCES))
104 $class = __NAMESPACE__ .
'\\Source\\' . $sourceType;
105 $data = $class::getData($sourceId);
112 $kbId = self::getLastCreatedSite();
115 'TITLE' => $data[
'TITLE'],
120 if ($res->isSuccess())
125 'ID' => $landing->getId(),
126 'TITLE' => $landing->getTitle()
129 foreach ($data[
'BLOCKS'] as $blockData)
131 $blockMeta = self::getBlockMetaByType($blockData[
'type']);
134 $blockId = $landing->addBlock($blockMeta[
'code'], [
139 $block = $landing->getBlockById($blockId);
140 if ($blockData[
'type'] ==
'img')
145 $block->updateNodes([
146 $blockMeta[
'selector'] => [$blockData[
'content']]
153 'ID' => $landing->getId(),
154 'TITLE' => $landing->getTitle(),
155 'PUBLIC_URL' => $landing->getPublicUrl()
static addToBlock(int $blockId, $fileId, bool $temp=false)
static setEditMode($mode=true)
static createInstance($id, array $params=array())
static createFromSource(int $kbId, string $sourceType, int $sourceId)
static getLastCreatedSite()
static getBlockMetaByType(string $type)
static rememberLastSite(int $landingId)
static hasAccessForSite($siteId, $accessType, $deleted=false)
static addLandingToMenu(int $siteId, array $data)