• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/hook.php
  • Класс: BitrixLandingHook
  • Вызов: Hook::indexContent
static function indexContent($id, $type)
{
	$id = intval($id);

	if ($type == self::ENTITY_TYPE_LANDING)
	{
		$class = 'BitrixLandingLanding';
	}

	if (!isset($class))
	{
		return;
	}

	// base fields
	$searchContent = $class::getList([
		'select' => [
			'TITLE', 'DESCRIPTION'
		],
		'filter' => [
			'ID' => $id,
			'=DELETED' => ['Y', 'N'],
			'=SITE.DELETED' => ['Y', 'N']
		]
	])->fetch();
	if (!$searchContent)
	{
		return;
	}

	$searchContent = array_values($searchContent);

	// hook fields
	foreach (self::getList($id, $type) as $hook)
	{
		foreach ($hook->getFields() as $field)
		{
			if ($field->isSearchable())
			{
				$searchContent[] = $field->getValue();
			}
		}
	}

	$searchContent = array_unique($searchContent);
	$searchContent = $searchContent ? implode(' ', $searchContent) : '';
	$searchContent = trim($searchContent);

	if ($searchContent)
	{
		$res = $class::update($id, [
			'SEARCH_CONTENT' => $searchContent
		]);
		$res->isSuccess();
	}
}