You are here

public function GeolocationGeometry::getSettingsForm in Geolocation Field 8.3

Provide data provider settings form array.

Parameters

array $settings: The current data provider settings.

array $parents: Form parents.

Return value

array A form array to be integrated in whatever.

Overrides DataProviderBase::getSettingsForm

File

modules/geolocation_geometry/src/Plugin/geolocation/DataProvider/GeolocationGeometry.php, line 76

Class

GeolocationGeometry
Provides GPX.

Namespace

Drupal\geolocation_geometry\Plugin\geolocation\DataProvider

Code

public function getSettingsForm(array $settings, array $parents = []) {
  $element = parent::getSettingsForm($settings, $parents);
  $settings = $this
    ->getSettings($settings);
  $element['stroke_color'] = [
    '#type' => 'color',
    '#title' => $this
      ->t('Stroke color'),
    '#default_value' => $settings['stroke_color'],
  ];
  $element['stroke_color_randomize'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Randomize stroke colors'),
    '#default_value' => $settings['stroke_color_randomize'],
  ];
  $element['stroke_width'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Stroke Width'),
    '#description' => $this
      ->t('Width of the stroke in pixels.'),
    '#default_value' => $settings['stroke_width'],
  ];
  $element['stroke_opacity'] = [
    '#type' => 'number',
    '#step' => 0.01,
    '#title' => $this
      ->t('Stroke Opacity'),
    '#description' => $this
      ->t('Opacity of the stroke from 1 = fully visible, 0 = complete see through.'),
    '#default_value' => $settings['stroke_opacity'],
  ];
  $element['fill_color'] = [
    '#type' => 'color',
    '#title' => $this
      ->t('Fill color'),
    '#default_value' => $settings['fill_color'],
  ];
  $element['fill_color_randomize'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Randomize fill colors'),
    '#default_value' => $settings['fill_color_randomize'],
  ];
  $element['fill_opacity'] = [
    '#type' => 'number',
    '#step' => 0.01,
    '#title' => $this
      ->t('Fill Opacity'),
    '#description' => $this
      ->t('Opacity of the polygons from 1 = fully visible, 0 = complete see through.'),
    '#default_value' => $settings['fill_opacity'],
  ];
  return $element;
}