You are here

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

Helper function. Create form elements for map marker settings.

Parameters

array $form: Form array.

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

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

File

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

Class

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

Namespace

Drupal\colorized_gmap\Plugin\Block

Code

public function buildFormMarker(array &$form, FormStateInterface &$form_state) {
  $form['additional_settings']['marker_settings'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Marker'),
    '#attributes' => [
      'class' => [
        'gmap_colorizer_input',
      ],
    ],
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  ];
  $form['additional_settings']['marker_settings']['markertitle'] = [
    '#type' => 'textfield',
    '#size' => 30,
    '#title' => $this
      ->t('Title'),
    '#default_value' => $this->configuration['additional_settings']['marker_settings']['markertitle'],
    '#description' => $this
      ->t('Title to display on the mouseover'),
  ];
  $form['additional_settings']['marker_settings']['displayPopupContent'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t("Open a marker\\'s content when the page is loaded"),
    '#default_value' => $this->configuration['additional_settings']['marker_settings']['displayPopupContent'],
  ];
  $form['additional_settings']['marker_settings']['info_window'] = [
    '#type' => 'text_format',
    '#title' => $this
      ->t('Marker Popup Content (info window)'),
    '#description' => $this
      ->t('Text for info window. An InfoWindow displays content (usually text or images) in a popup window above the map after clicking on the marker'),
    '#format' => $this->configuration['additional_settings']['marker_settings']['info_window']['format'],
    '#default_value' => $this->configuration['additional_settings']['marker_settings']['info_window']['value'],
    '#ajax' => [
      'callback' => 'Drupal\\colorized_gmap\\Plugin\\Block\\ColorizedGmapBlock::stylesMapUpdateCallback',
      'event' => 'change',
      'wrapper' => 'colorized-gmap-content',
    ],
  ];
  $form['additional_settings']['marker_settings']['marker'] = [
    'url' => [
      '#type' => 'textfield',
      '#size' => 30,
      '#title' => $this
        ->t('Url icon'),
      '#default_value' => $this->configuration['additional_settings']['marker_settings']['marker']['url'],
    ],
  ];
}