openlayers-8.x-4.x-dev/src/Plugin/Control/OverviewMap/OverviewMap.php
src/Plugin/Control/OverviewMap/OverviewMap.php
<?php
namespace Drupal\openlayers\Plugin\Control\OverviewMap;
use Drupal\Core\Form\FormStateInterface;
use Drupal\openlayers\Types\Control;
/**
* Defines the Overview Map control for an Openlayers map.
*
* @OpenlayersPlugin(
* id = "ol_control_overviewmap",
* label = @Translation("Overview Map"),
* description = @Translation("Define a Overview Map control."),
* service = "openlayers.Control:OverviewMap",
* library = "openlayers-plugin-control-overviewmap",
* is_configurable = "false",
* type = "control"
* )
*/
class OverviewMap extends Control {
/**
* {@inheritdoc}
*/
public function getSummary() {
$summary = [
'#theme' => 'openlayers_control_summary',
'#data' => $this->configuration,
];
$summary += parent::getSummary();
return $summary;
}
/**
* {@inheritdoc}
*/
public function defaultConfiguration() {
return [
'className' => 'ol-overviewmap',
];
}
/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form['className'] = [
'#type' => 'textfield',
'#default_value' => $this->configuration['className'],
'#title' => t('Class name'),
'#description' => t('CSS class name.'),
'#size' => 50,
'#maxlength' => 50,
'#required' => FALSE,
];
return $form;
}
/**
* {@inheritdoc}
*/
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
}
/**
* {@inheritdoc}
*/
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
parent::submitConfigurationForm($form, $form_state);
$this->configuration['className'] = $form_state->getValue('className');
}
}
