You are here

geocoder_field.api.php in Geocoder 8.3

Same filename and directory in other branches
  1. 8.2 modules/geocoder_field/geocoder_field.api.php

Hooks provided by the Geocoder Field module.

File

modules/geocoder_field/geocoder_field.api.php
View source
<?php

/**
 * @file
 * Hooks provided by the Geocoder Field module.
 */
use Drupal\Core\Field\FieldItemListInterface;

/**
 * Alter the List of Field types objects of Geocoding operations.
 *
 * Modules may implement this hook to alter the list of possible Geocoding
 * Field Types.
 *
 * @param array $source_fields_types
 *   The list of possible Geocoding Field Types.
 *
 * @see \Drupal\search_api\Backend\BackendPluginBase
 */
function hook_geocode_source_fields_alter(array &$source_fields_types) {
  array_push($source_fields_types, "my_new_field_1", "my_new_field_2");
}

/**
 * Alter the List of Field types objects of Reverse Geocoding operations.
 *
 * Modules may implement this hook to alter the list of Reverse Geocoding
 * Field Types.
 *
 * @param array $source_fields_types
 *   The list of possible Reverse Geocoding Field Types.
 *
 * @see \Drupal\search_api\Backend\BackendPluginBase
 */
function hook_reverse_geocode_source_fields_alter(array &$source_fields_types) {
  array_push($source_fields_types, "my_new_field_1", "my_new_field_2");
}

/**
 * Alter the Entity Field Address String to Geocode on Presave.
 *
 * @param string $address_string
 *   The address string to geocode.
 * @param \Drupal\Core\Field\FieldItemListInterface $field
 *   The field object of geocode op.
 */
function hook_geocode_entity_field_address_string_alter(string &$address_string, FieldItemListInterface $field) {

  // Make custom alterations to adjust the address string.
}

/**
 * Alter the Entity Field Coordinates to Reverse Geocode.
 *
 * @param string $latitude
 *   The latitude.
 * @param string $longitude
 *   The longitude.
 * @param \Drupal\Core\Field\FieldItemListInterface $field
 *   The field object of geocode op.
 */
function hook_reverse_geocode_entity_field_coordinates_alter(string &$latitude, string &$longitude, FieldItemListInterface $field) {

  // Make custom alterations to the Coordinates to Reverse Geocode.
}

Functions

Namesort descending Description
hook_geocode_entity_field_address_string_alter Alter the Entity Field Address String to Geocode on Presave.
hook_geocode_source_fields_alter Alter the List of Field types objects of Geocoding operations.
hook_reverse_geocode_entity_field_coordinates_alter Alter the Entity Field Coordinates to Reverse Geocode.
hook_reverse_geocode_source_fields_alter Alter the List of Field types objects of Reverse Geocoding operations.