You are here

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

Helper function. Create form elements for map zoom position settings.

Parameters

array $form: Form array.

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

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

File

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

Class

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

Namespace

Drupal\colorized_gmap\Plugin\Block

Code

public function buildFormCoordinates(array &$form, FormStateInterface &$form_state) {
  $form['coordinates'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Coordinates'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
    '#weight' => -1,
  ];
  $form['coordinates']['latitude'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Latitude'),
    '#size' => 10,
    '#weight' => 0,
    '#default_value' => $this->configuration['coordinates']['latitude'],
    '#ajax' => [
      'callback' => 'Drupal\\colorized_gmap\\Plugin\\Block\\ColorizedGmapBlock::stylesMapUpdateCallback',
      'wrapper' => 'colorized-gmap-content',
      'event' => 'change',
    ],
  ];
  $form['coordinates']['longitude'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Longitude'),
    '#size' => 10,
    '#weight' => 2,
    '#default_value' => $this->configuration['coordinates']['longitude'],
    '#ajax' => [
      'callback' => 'Drupal\\colorized_gmap\\Plugin\\Block\\ColorizedGmapBlock::stylesMapUpdateCallback',
      'event' => 'change',
      'wrapper' => 'colorized-gmap-content',
    ],
  ];
}