You are here

function openlayers_contextual_links_form_openlayers_map_form_settings_alter in Openlayers 7.3

Implements hook_form_BASE_FORM_ID_alter().

File

modules/openlayers_contextual_links/openlayers_contextual_links.module, line 85
Openlayers Contextual Links module.

Code

function openlayers_contextual_links_form_openlayers_map_form_settings_alter(&$form, &$form_state) {
  if (($map = \Drupal\openlayers\Openlayers::load('Map', $form_state['item'])) == TRUE) {
    $form['options']['ui']['contextualLinks'] = array(
      '#type' => 'checkbox',
      '#title' => 'Contextual links',
      '#description' => t('Enable contextual links on the map.'),
      '#default_value' => $map
        ->getOption('contextualLinks', FALSE),
      '#parents' => array(
        'options',
        'contextualLinks',
      ),
    );
  }
}