You are here

function openlayers_block_switcher_form_openlayers_map_form_settings_alter in Openlayers 7.3

Implements hook_form_FORM_ID_alter().

File

modules/openlayers_block_switcher/openlayers_block_switcher.module, line 136
Openlayers Block Switcher.

Code

function openlayers_block_switcher_form_openlayers_map_form_settings_alter(&$form, &$form_state) {
  if (($map = \Drupal\openlayers\Openlayers::load('Map', $form_state['item'])) == TRUE) {
    $form['options']['ui']['provideBlockLayerSwitcher'] = array(
      '#type' => 'checkbox',
      '#title' => 'Provide Drupal block layer switcher',
      '#description' => t('Enable this to enable a Drupal block to display a layer switcher.'),
      '#default_value' => $map
        ->getOption('provideBlockLayerSwitcher', FALSE),
      '#parents' => array(
        'options',
        'provideBlockLayerSwitcher',
      ),
    );
  }
}