You are here

interface GeocoderInterface in Geolocation Field 8.3

Same name and namespace in other branches
  1. 8 src/GeocoderInterface.php \Drupal\geolocation\GeocoderInterface
  2. 8.2 src/GeocoderInterface.php \Drupal\geolocation\GeocoderInterface

Defines an interface for geolocation geocoder plugins.

Hierarchy

Expanded class hierarchy of GeocoderInterface

All classes that implement GeocoderInterface

5 files declare their use of GeocoderInterface
Geocodio.php in modules/geolocation_geocodio/src/Plugin/geolocation/Geocoder/Geocodio.php
GoogleGeocoderBase.php in modules/geolocation_google_maps/src/GoogleGeocoderBase.php
Nominatim.php in modules/geolocation_leaflet/src/Plugin/geolocation/Geocoder/Nominatim.php
Photon.php in modules/geolocation_leaflet/src/Plugin/geolocation/Geocoder/Photon.php
Yandex.php in modules/geolocation_yandex/src/Plugin/geolocation/Geocoder/Yandex.php

File

src/GeocoderInterface.php, line 10

Namespace

Drupal\geolocation
View source
interface GeocoderInterface extends PluginInspectionInterface {

  /**
   * Return additional options form.
   *
   * @return array
   *   Options form.
   */
  public function getOptionsForm();

  /**
   * Process the form built above.
   *
   * @param array $form_element
   *   Options form.
   *
   * @return array|null
   *   Settings to store or NULL.
   */
  public function processOptionsForm(array $form_element);

  /**
   * Attach geocoding logic to input element.
   *
   * @param array $render_array
   *   Form containing the input element.
   * @param string $element_name
   *   Name of the input element.
   *
   * @return array|null
   *   Updated form element or NULL.
   */
  public function formAttachGeocoder(array &$render_array, $element_name);

  /**
   * Geocode an address.
   *
   * @param string $address
   *   Address to geocode.
   *
   * @return array||null
   *   Location or NULL.
   */
  public function geocode($address);

  /**
   * Reverse geocode an address.
   *
   * Intended return subject to available data:
   *
   * @code
   * [
   *   'organization' => '',
   *   'address_line1' => '',
   *   'address_line2' => '',
   *   'postal_code' => '',
   *   'sorting_code' => '',
   *   'dependent_locality' => [],
   *   'locality' => [],
   *   'administrative_area' => [],
   *   'country' => [],
   *
   *   'formatted_address' => '',
   * ]
   * @endcode
   *
   * @param float $latitude
   *   Latitude to reverse geocode.
   * @param float $longitude
   *   Longitude to reverse geocode.
   *
   * @return array||null
   *   Address or NULL.
   */
  public function reverseGeocode($latitude, $longitude);

}

Members

Namesort descending Modifiers Type Description Overrides
GeocoderInterface::formAttachGeocoder public function Attach geocoding logic to input element. 1
GeocoderInterface::geocode public function Geocode an address. 1
GeocoderInterface::getOptionsForm public function Return additional options form. 1
GeocoderInterface::processOptionsForm public function Process the form built above. 1
GeocoderInterface::reverseGeocode public function Reverse geocode an address. 1
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2