public function MapProviderBase::alterRenderArray in Geolocation Field 8.3
Same name and namespace in other branches
- 8.2 src/MapProviderBase.php \Drupal\geolocation\MapProviderBase::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 MapProviderInterface::alterRenderArray
5 calls to MapProviderBase::alterRenderArray()
- Baidu::alterRenderArray in modules/
geolocation_baidu/ src/ Plugin/ geolocation/ MapProvider/ Baidu.php - Alter render array.
- GoogleMaps::alterRenderArray in modules/
geolocation_google_maps/ src/ Plugin/ geolocation/ MapProvider/ GoogleMaps.php - Alter render array.
- Here::alterRenderArray in modules/
geolocation_here/ src/ Plugin/ geolocation/ MapProvider/ Here.php - Alter render array.
- Leaflet::alterRenderArray in modules/
geolocation_leaflet/ src/ Plugin/ geolocation/ MapProvider/ Leaflet.php - Alter render array.
- Yandex::alterRenderArray in modules/
geolocation_yandex/ src/ Plugin/ geolocation/ MapProvider/ Yandex.php - Alter render array.
6 methods override MapProviderBase::alterRenderArray()
- Baidu::alterRenderArray in modules/
geolocation_baidu/ src/ Plugin/ geolocation/ MapProvider/ Baidu.php - Alter render array.
- GoogleMaps::alterRenderArray in modules/
geolocation_google_maps/ src/ Plugin/ geolocation/ MapProvider/ GoogleMaps.php - Alter render array.
- GoogleStaticMaps::alterRenderArray in modules/
geolocation_google_maps/ modules/ geolocation_google_static_maps/ src/ Plugin/ geolocation/ MapProvider/ GoogleStaticMaps.php - Alter render array.
- Here::alterRenderArray in modules/
geolocation_here/ src/ Plugin/ geolocation/ MapProvider/ Here.php - Alter render array.
- Leaflet::alterRenderArray in modules/
geolocation_leaflet/ src/ Plugin/ geolocation/ MapProvider/ Leaflet.php - Alter render array.
File
- src/
MapProviderBase.php, line 258
Class
- MapProviderBase
- Provide Map Provider Base class.
Namespace
Drupal\geolocationCode
public function alterRenderArray(array $render_array, array $map_settings, array $context = []) {
if (!empty($map_settings['map_features'])) {
uasort($map_settings['map_features'], '\\Drupal\\Component\\Utility\\SortArray::sortByWeightElement');
foreach ($map_settings['map_features'] as $feature_id => $feature_settings) {
if (!empty($feature_settings['enabled'])) {
$feature = $this->mapFeatureManager
->getMapFeature($feature_id, []);
if ($feature) {
if (empty($feature_settings['settings'])) {
$feature_settings['settings'] = [];
}
$render_array = $feature
->alterMap($render_array, $feature
->getSettings($feature_settings['settings']), $context);
}
}
}
}
return $render_array;
}