public function ColorizedGmapBlock::buildFormControls in Colorized google maps block 8
Helper function. Create form elements for map controls settings.
Parameters
array $form: Form array.
\Drupal\Core\Form\FormStateInterface $form_state: Form state.
null $entity: Entity.
1 call to ColorizedGmapBlock::buildFormControls()
- ColorizedGmapBlock::blockForm in src/
Plugin/ Block/ ColorizedGmapBlock.php
File
- src/
Plugin/ Block/ ColorizedGmapBlock.php, line 701
Class
- ColorizedGmapBlock
- Provides a 'Example: configurable text string' block.
Namespace
Drupal\colorized_gmap\Plugin\BlockCode
public function buildFormControls(array &$form, FormStateInterface &$form_state, $entity = NULL) {
// @todo: get existing configs.
$form['additional_settings']['controls'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Controls'),
'#weight' => 1,
'#collapsible' => FALSE,
'#collapsed' => FALSE,
];
$form['additional_settings']['controls']['min_drag_width'] = [
'#type' => 'textfield',
'#title' => $this
->t('Min draggable screnn width'),
'#size' => 5,
'#description' => $this
->t('If your screen width is greater, the map will be draggable. Enter 0 to make map always draggable.'),
'#default_value' => $this->configuration['additional_settings']['controls']['min_drag_width'],
'#field_suffix' => 'px',
];
$form['additional_settings']['controls']['streetViewControl'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable streetview control'),
'#default_value' => $this->configuration['additional_settings']['controls']['min_drag_width'],
];
$form['additional_settings']['controls']['panControl'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable pan control'),
'#default_value' => $this->configuration['additional_settings']['controls']['panControl'],
];
$form['additional_settings']['controls']['mapTypeControl'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable map type control'),
'#default_value' => $this->configuration['additional_settings']['controls']['mapTypeControl'],
];
}