You are here

styled_google_map_data.module in Styled Google Map 8.2

File

modules/data/styled_google_map_data.module
View source
<?php

use Drupal\Core\Form\FormStateInterface;

/**
 * Implements hook_preprocess_HOOK().
 */
function styled_google_map_data_preprocess_page() {

  // Display message about demo content.
  \Drupal::messenger()
    ->addStatus(t('Example pages are available here: <a href="/heatmap" target="_blank">Heatmap</a>, <a href="/cluster-map" target="_blank">cluster</a>, <a href="/cluster-map-spiderified" target="_blank">spiderified cluster</a>, <a href="/map-controls" target="_blank">custom controls</a>, <a href="/real_estate/1" target="_blank">single item</a>'));
  \Drupal::messenger()
    ->addWarning(t('Do not forget to put Google Maps API Key <a href="/admin/config/services/styled_google_map">here</a>'));
}

/**
 * Implements hook_form_alter().
 */
function styled_google_map_data_form_views_exposed_form_alter(array &$form, FormStateInterface $form_state, $form_id) {
  $view = $form_state
    ->get('view');
  if ($view
    ->id() == 'styled_google_map' && $view->current_display == 'page_4') {
    $form['#attributes']['class'][] = 'google-map-control';
    $form['#attributes']['data-position'] = 'TOP_LEFT';
  }
}