LeafletControlRecenter.php in Geolocation Field 8.3
File
modules/geolocation_leaflet/src/Plugin/geolocation/MapFeature/LeafletControlRecenter.php
View source
<?php
namespace Drupal\geolocation_leaflet\Plugin\geolocation\MapFeature;
class LeafletControlRecenter extends ControlCustomElementBase {
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;
}
}