• Модуль: seo
  • Путь к файлу: ~/bitrix/modules/seo/lib/ui/provider/regionsprovider.php
  • Класс: BitrixSeoUIProviderRegionsProvider
  • Вызов: RegionsProvider::doSearch
public function doSearch(SearchQuery $searchQuery, Dialog $dialog): void
{
	$service = Configurator::getService();
	$service->setClientId($this->getOption('clientId'));
	$searchQuery->setCacheable(false);

	$response = Configurator::searchTargetingData(
		AdCampaignFacebook::TYPE_CODE,
		[
			'q' => $searchQuery->getQuery(),
			'type' => static::SEARCH_TYPE
		]
	);

	$items = [];

	foreach ($response as $value)
	{
		if (!isset($value['key']))
		{
			continue;
		}

		$items[] =
			new Item(
				[
					'id' => $value['key'],
					'entityId' => static::ENTITY_TYPE,
					'title' => $value['name'],
					'tagOptions' => [
						'bgColor' => "#{$this->stringToColor($value['key'])}",
						'textColor' => "#fff"
					],
					'customData' => [
						'type' => $value['type'],
					]
				]
			);
	}

	$dialog->addItems(
		$items
	);
}