66 || !self::isMapBlock($block)
73 isset(self::$manifestStore[$block->getId()])
74 && !empty(self::$manifestStore[$block->getId()])
77 return self::$manifestStore[$block->getId()];
81 self::readProviderFromBlock($block);
84 $manifest[
'callbacks'] = [
85 'afterAdd' =>
function (
Block &$block)
87 $dom = $block->getDom();
88 $node = $dom->querySelector(self::MAP_SELECTOR);
94 $attrsExists = $node->getAttributes();
95 if (isset($attrsExists[
'data-map']) && $attrsExists[
'data-map'] !==
'')
100 $isUseYandex = self::$settings[
'YMAP'][
'USE'] && !empty(self::$settings[
'YMAP'][
'CODE']);
102 (!self::$settings[
'YMAP'][
'USE'] || empty(self::$settings[
'YMAP'][
'CODE']))
103 && (!self::$settings[
'GMAP'][
'USE'] || empty(self::$settings[
'GMAP'][
'CODE']));
105 $providerForNewBlock = self::PROVIDER_DEFAULT;
107 ($isUseYandex || $isNotSettings)
108 && self::canUseYandex()
111 $providerForNewBlock = self::PROVIDER_YANDEX;
114 $block->setAttributes([
115 self::MAP_SELECTOR => [
116 'data-map-provider' => $providerForNewBlock,
121 'center' => self::getDefaultMapCenter(),
125 'latLng' => self::getDefaultMapCenter(),
126 'title' =>
'Bitrix24',
127 'description' =>
'Bitrix24 - Your company. United.',
131 $block->setAttributes([
132 self::MAP_SELECTOR => [
133 'data-map' => $defaultOptions,
139 unset(self::$manifestStore[$block->getId()]);
143 $manifest = self::addRequiredUserAction($manifest);
144 $manifest = self::addNodes($manifest);
145 $manifest = self::addSettings($manifest);
146 $manifest = self::addVisualSettings($manifest);
147 $manifest = self::addAssets($manifest);
150 $manifest[
'disableCache'] =
true;
151 self::$manifestStore[$block->getId()] = $manifest;
252 self::$provider === self::PROVIDER_GOOGLE
253 && (!self::$settings[
'GMAP'][
'USE'] || empty(self::$settings[
'GMAP'][
'CODE']));
255 self::$provider === self::PROVIDER_YANDEX
256 && (!self::$settings[
'YMAP'][
'USE'] || empty(self::$settings[
'YMAP'][
'CODE']));
261 if ($isYandexFail && self::canUseYandex())
266 elseif ($isGoogleFail)
272 $isEmptyRequiredUserAction =
273 !isset($manifest[
'requiredUserAction'])
274 || !is_array($manifest[
'requiredUserAction'])
276 if ($error && $isEmptyRequiredUserAction)
278 $manifest[
'requiredUserAction'] = [
280 'description' => $description,
282 'href' =>
'#page_url_site_edit@map_required_key',
283 'className' =>
'landing-required-link',
284 'targetNodeSelector' => self::MAP_SELECTOR,
315 'attribute' =>
'data-map',
321 if (self::canUseYandex())
325 'attribute' =>
'data-map-provider',
328 [
'name' =>
Loc::getMessage(
'LANDING_GOOGLE_MAP-PROVIDER-G'),
'value' => self::PROVIDER_GOOGLE],
329 [
'name' =>
Loc::getMessage(
'LANDING_GOOGLE_MAP-PROVIDER-Y'),
'value' => self::PROVIDER_YANDEX],
331 'requireReload' =>
true,
336 !isset($manifest[
'attrs'][self::MAP_SELECTOR])
337 || !is_array($manifest[
'attrs'][self::MAP_SELECTOR])
340 $manifest[
'attrs'][self::MAP_SELECTOR] = [];
342 $manifest[
'attrs'][self::MAP_SELECTOR] = array_merge($manifest[
'attrs'][self::MAP_SELECTOR], $attrs);