public function LeafletControlLocate::alterMap in Geolocation Field 8.2
Same name and namespace in other branches
- 8.3 modules/geolocation_leaflet/src/Plugin/geolocation/MapFeature/LeafletControlLocate.php \Drupal\geolocation_leaflet\Plugin\geolocation\MapFeature\LeafletControlLocate::alterMap()
Alter render array.
Parameters
array $render_array: Render array.
array $feature_settings: The current feature settings.
array $context: Context like field formatter, field widget or view.
Return value
array Render array.
Overrides ControlCustomElementBase::alterMap
File
- modules/
geolocation_leaflet/ src/ Plugin/ geolocation/ MapFeature/ LeafletControlLocate.php, line 20
Class
- LeafletControlLocate
- Provides Locate control element.
Namespace
Drupal\geolocation_leaflet\Plugin\geolocation\MapFeatureCode
public function alterMap(array $render_array, array $feature_settings, array $context = []) {
$render_array = parent::alterMap($render_array, $feature_settings, $context);
$render_array['#controls'][$this
->getPluginId()]['control_locate'] = [
'#type' => 'html_tag',
'#tag' => 'a',
'#attributes' => [
'class' => [
'locate',
],
'href' => '#',
'title' => $this
->t('Locate'),
'role' => 'button',
],
];
$render_array['#controls'][$this
->getPluginId()]['#attributes']['class'][] = 'leaflet-bar';
return $render_array;
}