openlayers-8.x-4.x-dev/modules/openlayers_geofield/src/Plugin/Control/Geofield/Geofield.php

modules/openlayers_geofield/src/Plugin/Control/Geofield/Geofield.php
<?php

namespace Drupal\openlayers_geofield\Plugin\Control\Geofield;

use Drupal\openlayers\Types\Control;
use Drupal\Core\Form\FormStateInterface;

/**
 * Defines an Editing Toolbar for a Geofield.
 *
 * @OpenlayersPlugin(
 *   id = "ol_control_geofield",
 *   label = @Translation("Geofield Editing Toolbar"),
 *   description = @Translation("Defines a Geofield Editing Toolbar."),
 *   service = "openlayers.Control:Geofield",
 *   library = "openlayers-plugin-control-geofield",
 *   is_configurable = "true",
 *   type = "control"
 * )
 */
class Geofield extends Control {

  /**
   * FIX - Insert short comment here.
   */
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {

    $form['options']['draw'] = array(
      '#type' => 'checkboxes',
      '#title' => 'Draw actions',
      '#default_value' => isset($form['options']['draw']) ? (array) $form['options']['draw'] : [],
      '#options' => array(
        'Point' => 'Point',
        'MultiPoint' => 'MultiPoint',
        'LineString' => 'LineString',
        'MultiLineString' => 'MultiLineString',
        'Polygon' => 'Polygon',
        'MultiPolygon' => 'MultiPolygon',
        'Triangle' => 'Triangle',
        'Square' => 'Square',
        'Circle' => 'Circle',
        'Box' => 'Box',
      ),
    );
    $form['options']['actions'] = array(
      '#type' => 'checkboxes',
      '#title' => 'Edit options',
      '#default_value' => isset($form['options']['actions']) ? (array) $form['options']['actions'] : [],
      '#options' => array(
        'Edit' => 'Select and edit a feature',
        'Move' => 'Move the feature',
        'Clear' => 'Clear the map',
      ),
    );
    $form['options']['options'] = array(
      '#type' => 'checkboxes',
      '#title' => 'Options',
      '#default_value' => isset($form['options']['options']) ? (array) $form['options']['options'] : [],
      '#options' => array(
        'Snap' => 'Snap the feature between each others',
      ),
    );
    return $form;
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc