MapFeatureFrontendBase.php in Geolocation Field 8.3
File
src/MapFeatureFrontendBase.php
View source
<?php
namespace Drupal\geolocation;
use Drupal\Core\Render\BubbleableMetadata;
abstract class MapFeatureFrontendBase extends MapFeatureBase {
public function alterMap(array $render_array, array $feature_settings, array $context = []) {
$render_array = parent::alterMap($render_array, $feature_settings, $context);
$render_array['#attached'] = BubbleableMetadata::mergeAttachments(empty($render_array['#attached']) ? [] : $render_array['#attached'], [
'library' => [
$this
->getPluginDefinition()['provider'] . '/mapfeature.' . $this
->getPluginId(),
],
'drupalSettings' => [
'geolocation' => [
'maps' => [
$render_array['#id'] => [
$this
->getPluginId() => [
'enable' => TRUE,
],
],
],
],
],
]);
return $render_array;
}
}