geolocation-8.x-3.x-dev/geolocation.module
geolocation.module
<?php
/**
* @file
* Defines a simple geolocation field type.
*/
use Drupal\Core\Hook\Attribute\LegacyHook;
use Drupal\Core\Render\BubbleableMetadata;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\field\FieldStorageConfigInterface;
use Drupal\geolocation\Hook\Geolocation;
use Drupal\geolocation\Hook\Tokens;
use Drupal\geolocation\Hook\Views;
/**
* Implements hook_help().
*/
#[LegacyHook]
function geolocation_help(string $route_name, RouteMatchInterface $route_match): ?string {
$geolocation = new Geolocation();
return $geolocation->help($route_name, $route_match);
}
/**
* Implements hook_theme().
*/
#[LegacyHook]
function geolocation_theme(): array {
$geolocation = new Geolocation();
return $geolocation->theme();
}
/**
* Implements hook_migrate_field_info_alter().
*/
#[LegacyHook]
function geolocation_migrate_field_info_alter(array &$definitions): void {
$geolocation = new Geolocation();
$geolocation->migrateFieldInfoAlter($definitions);
}
/**
* Implements hook_token_info().
*/
#[LegacyHook]
function geolocation_token_info(): array {
$tokens = new Tokens();
return $tokens->tokenInfo();
}
/**
* Implements hook_tokens().
*/
#[LegacyHook]
function geolocation_tokens(string $type, array $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata): array {
$tokens_handler = new Tokens();
return $tokens_handler->tokensReplacement($type, $tokens, $data, $options, $bubbleable_metadata);
}
/**
* Implements hook_field_views_data().
*/
#[LegacyHook]
function geolocation_field_views_data(FieldStorageConfigInterface $field_storage): array {
$views = new Views();
return $views->fieldViewsData($field_storage);
}
