Fill.php in Openlayers 8.4
File
src/Plugin/OpenlayersStyle/Fill.php
View source
<?php
namespace Drupal\openlayers\Plugin\OpenlayersStyle;
use Drupal\Component\Utility\Color;
use Drupal\Component\Utility\Rectangle;
use Drupal\Core\Form\FormStateInterface;
use Drupal\openlayers\OpenlayersConfigurablePluginBase;
class Fill extends OpenlayersConfigurablePluginBase {
public function getSummary() {
$summary = [
'#theme' => 'openlayers_style_summary',
'#data' => $this->configuration,
];
$summary += parent::getSummary();
return $summary;
}
public function defaultConfiguration() {
return [
'color' => NULL,
];
}
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form['color'] = [
'#type' => 'textfield',
'#default_value' => $this->configuration['color'],
'#title' => t('Fill color'),
'#description' => t('The color to be used for filling polygon features on the map. Use web-style hex colors (#FFFFFF for white, #000000 for black).'),
'#size' => 20,
'#maxlength' => 20,
'#required' => FALSE,
];
return $form;
}
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
}
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
parent::submitConfigurationForm($form, $form_state);
$this->configuration['color'] = $form_state
->getValue('color');
}
}
Classes
Name |
Description |
Fill |
Defines the Fill style for Openlayers features. |