You are here

geocoder.module in Geocoder 8.3

File

geocoder.module
View source
<?php

/**
 * @file
 * Geocoder Module.
 */
declare (strict_types=1);
use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_theme().
 */
function geocoder_theme($existing, $type, $theme, $path) {
  return [
    'geocoder_help' => [
      'template' => 'help',
    ],
  ];
}

/**
 * Implements hook_help().
 */
function geocoder_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {

    // Main module help for the geocoder module.
    case 'help.page.geocoder':
      $element = [
        '#theme' => 'geocoder_help',
      ];
      return \Drupal::service('renderer')
        ->render($element);
    default:
      return '';
  }
}

/**
 * Implements hook_geocoder_provider_info_alter().
 *
 * @param array $plugins
 *   The list of plugin definitions to alter, passed by reference.
 */
function geocoder_geocoder_provider_info_alter(array &$plugins) : void {

  // Remove plugins for which the providers are not installed.
  $plugins = array_filter($plugins, function (array $plugin) : bool {
    return empty($plugin['handler']) || class_exists($plugin['handler']);
  });
}

Functions

Namesort descending Description
geocoder_geocoder_provider_info_alter Implements hook_geocoder_provider_info_alter().
geocoder_help Implements hook_help().
geocoder_theme Implements hook_theme().