You are here

public function ColorizedGmapBlock::buildFormZoom in Colorized google maps block 8

Helper function. Create form elements for map zoom settings.

Parameters

array $form: Form array.

\Drupal\Core\Form\FormStateInterface $form_state: Form state.

1 call to ColorizedGmapBlock::buildFormZoom()
ColorizedGmapBlock::blockForm in src/Plugin/Block/ColorizedGmapBlock.php

File

src/Plugin/Block/ColorizedGmapBlock.php, line 649

Class

ColorizedGmapBlock
Provides a 'Example: configurable text string' block.

Namespace

Drupal\colorized_gmap\Plugin\Block

Code

public function buildFormZoom(array &$form, FormStateInterface &$form_state) {

  // @todo: get existing configs.
  $form['additional_settings']['zoom_controls'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Zoom control settings'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  ];
  $form['additional_settings']['zoom_controls']['zoom'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Zoom'),
    '#size' => 10,
    '#default_value' => $this->configuration['additional_settings']['zoom_controls']['zoom'],
    '#description' => $this
      ->t('Enter zoom amount'),
  ];
  $form['additional_settings']['zoom_controls']['zoomControl'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Enable zoom control'),
    '#default_value' => $this->configuration['additional_settings']['zoom_controls']['zoomControl'],
  ];
  $form['additional_settings']['zoom_controls']['scrollwheel'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Enable scrollwheel zoom'),
    '#default_value' => $this->configuration['additional_settings']['zoom_controls']['scrollwheel'],
  ];
  $form['additional_settings']['zoom_controls']['zoomControlSize'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Zoom Control Size'),
    '#options' => [
      '1' => 'Small',
      '2' => 'Large',
    ],
    '#default_value' => $this->configuration['additional_settings']['zoom_controls']['zoomControlSize'],
  ];
  $form['additional_settings']['zoom_controls']['zoomControlPosition'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Zoom Control Position'),
    '#options' => $this
      ->getPositionOptions(),
    '#default_value' => $this->configuration['additional_settings']['zoom_controls']['zoomControlPosition'],
  ];
}