public function LeafletControlRecenter::alterMap in Geolocation Field 8.3
Same name and namespace in other branches
- 8.2 modules/geolocation_leaflet/src/Plugin/geolocation/MapFeature/LeafletControlRecenter.php \Drupal\geolocation_leaflet\Plugin\geolocation\MapFeature\LeafletControlRecenter::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/ LeafletControlRecenter.php, line 20
Class
- LeafletControlRecenter
- Provides Recenter control element.
Namespace
Drupal\geolocation_leaflet\Plugin\geolocation\MapFeatureCode
public function alterMap(array $render_array, array $settings, array $context = []) {
$render_array = parent::alterMap($render_array, $settings, $context);
$render_array['#controls'][$this
->getPluginId()]['control_recenter'] = [
'#type' => 'html_tag',
'#tag' => 'a',
'#attributes' => [
'class' => [
'recenter',
],
'href' => '#',
'title' => $this
->t('Recenter'),
'role' => 'button',
],
];
$render_array['#controls'][$this
->getPluginId()]['#attributes']['class'][] = 'leaflet-bar';
return $render_array;
}