public function Here::alterRenderArray in Geolocation Field 8.3
Same name and namespace in other branches
- 8.2 modules/geolocation_here/src/Plugin/geolocation/MapProvider/Here.php \Drupal\geolocation_here\Plugin\geolocation\MapProvider\Here::alterRenderArray()
Alter render array.
Parameters
array $render_array: Render array.
array $map_settings: The current map settings.
array $context: Context like field formatter, field widget or view.
Return value
array Render attachments.
Overrides MapProviderBase::alterRenderArray
File
- modules/
geolocation_here/ src/ Plugin/ geolocation/ MapProvider/ Here.php, line 111
Class
- Here
- Provides HERE Maps API.
Namespace
Drupal\geolocation_here\Plugin\geolocation\MapProviderCode
public function alterRenderArray(array $render_array, array $map_settings, array $context = []) {
$config = \Drupal::config('here_maps.settings');
$render_array['#attached'] = BubbleableMetadata::mergeAttachments(empty($render_array['#attached']) ? [] : $render_array['#attached'], [
'library' => [
'geolocation_here/geolocation.here',
],
'drupalSettings' => [
'geolocation' => [
'hereMapsAppId' => $config
->get('app_id'),
'hereMapsAppCode' => $config
->get('app_code'),
'maps' => [
$render_array['#id'] => [
'settings' => [
'here_settings' => $map_settings,
],
],
],
],
],
]);
return parent::alterRenderArray($render_array, $map_settings, $context);
}