openlayers-8.x-4.x-dev/src/Plugin/Control/FullScreen/FullScreen.php

src/Plugin/Control/FullScreen/FullScreen.php
<?php

namespace Drupal\openlayers\Plugin\Control\FullScreen;

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

/**
 * Defines the Full Screen control for an Openlayers map.
 *
 * @OpenlayersPlugin(
 *   id = "ol_control_fullscreen",
 *   label = @Translation("Full Screen"),
 *   description = @Translation("Define a full screen control."),
 *   service = "openlayers.Control:FullScreen",
 *   library = "openlayers-plugin-control-fullscreen",
 *   is_configurable = "false",
 *   type = "control"
 * )
 */
class FullScreen 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-full-screen',
    ];
  }

  /**
   * {@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');
  }

}

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

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