You are here

geolocation.module in Geolocation Field 8.2

Defines a simple geolocation field type.

File

geolocation.module
View source
<?php

/**
 * @file
 * Defines a simple geolocation field type.
 */
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;

/**
 * Implements hook_help().
 */
function geolocation_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.geolocation':
      $output = '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('The Geolocation module allows you to create fields that contain geographical locations.
          See the <a href=":field">Field module help</a> and the <a href=":field_ui">Field UI help</a>
          pages for general information on fields and how to create and manage them.', [
        ':field' => Url::fromRoute('help.page', [
          'name' => 'field',
        ]),
        ':field_ui' => Url::fromRoute('help.page', [
          'name' => 'field_ui',
        ]),
      ]) . '</p>';
      return $output;
  }
  return NULL;
}

/**
 * Implements hook_theme().
 */
function geolocation_theme() {
  return [
    'geolocation_map_wrapper' => [
      'variables' => [
        'attributes' => NULL,
        'maptype' => NULL,
        'locations' => NULL,
        'centre' => NULL,
        'id' => NULL,
        'children' => NULL,
        'controls' => NULL,
        'context' => NULL,
      ],
    ],
    'geolocation_map_location' => [
      'variables' => [
        'attributes' => NULL,
        'children' => NULL,
        'title' => NULL,
        'position' => NULL,
        'id' => NULL,
        'hidden' => NULL,
        'icon' => NULL,
        'label' => NULL,
      ],
    ],
    'geolocation_latlng_formatter' => [
      'variables' => [
        'lat' => NULL,
        'lng' => NULL,
      ],
      'template' => 'geolocation-latlng-formatter',
    ],
    'geolocation_sexagesimal_formatter' => [
      'variables' => [
        'lat' => NULL,
        'lng' => NULL,
      ],
      'template' => 'geolocation-sexagesimal-formatter',
    ],
  ];
}

Functions

Namesort descending Description
geolocation_help Implements hook_help().
geolocation_theme Implements hook_theme().