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