• Модуль: salescenter
  • Путь к файлу: ~/bitrix/modules/salescenter/lib/integration/landingmanager.php
  • Класс: BitrixSalesCenterIntegrationLandingManager
  • Вызов: LandingManager::onHookExec
static function onHookExec()
{
	$result = new BitrixMainORMEventResult();

	$getMetaFromUrl = function(LandingHookPage $hook)
	{
		$hash = Application::getInstance()->getContext()->getRequest()->get(ImOpenLinesManager::META_PARAM);
		if($hash)
		{
			$meta = Meta::getByHash($hash);
			if($meta)
			{
				$title = $meta->getMeta('title');
				$description = $meta->getMeta('description');
				$image = $meta->getMeta('image');
				if($title || $description || $image)
				{
					if(!$title)
					{
						$title = $hook->getTitle();
					}
					if(!$description)
					{
						$description = $hook->getDescription();
					}
					$content = '
					';
					if(!$image)
					{
						$fields = $hook->getPageFields();
						if(isset($fields['METAOG_IMAGE']))
						{
							$field = $fields['METAOG_IMAGE'];
							$image = $field->getValue();
						}
					}
					if($image)
					{
						if (intval($image) > 0)
						{
							$image = LandingFile::getFileArray(intval($image));
							$image = $image['SRC'] ?? null;
							if ($image)
							{
								$image = LandingManager::getUrlFromFile($image);
							}
						}

						if ($image)
						{
							$content .= '';
							$content .= '';
							$content .= '';
						}
					}

					LandingManager::setPageView('MetaOG', $content);

					return true;
				}
			}
		}

		return false;
	};

	$result->modifyFields([
		'METAOG' => $getMetaFromUrl
	]);

	return $result;
}