You are here

public function GeocodeOrigin::__construct in Geocoder 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/GeofieldProximitySource/GeocodeOrigin.php \Drupal\geocoder\Plugin\GeofieldProximitySource\GeocodeOrigin::__construct()

Constructs a GeocodeOrigin object.

Parameters

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin_id for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

\Drupal\geocoder\Geocoder $geocoder: The Geocoder Service.

\Drupal\geocoder\ProviderPluginManager $providerPluginManager: The Providers Plugin Manager.

\Drupal\geocoder\FormatterPluginManager $formatterPluginManager: The Providers Plugin Manager.

Overrides PluginBase::__construct

1 call to GeocodeOrigin::__construct()
GeocodeOriginAutocomplete::__construct in src/Plugin/GeofieldProximitySource/deprecated/GeocodeOriginAutocomplete.php
Constructs a GeocodeOrigin object.
1 method overrides GeocodeOrigin::__construct()
GeocodeOriginAutocomplete::__construct in src/Plugin/GeofieldProximitySource/deprecated/GeocodeOriginAutocomplete.php
Constructs a GeocodeOrigin object.

File

src/Plugin/GeofieldProximitySource/GeocodeOrigin.php, line 119

Class

GeocodeOrigin
Defines 'Geocode Origin (with Autocomplete option)' proximity source plugin.

Namespace

Drupal\geocoder\Plugin\GeofieldProximitySource

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, Geocoder $geocoder, ProviderPluginManager $providerPluginManager, FormatterPluginManager $formatterPluginManager) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $this->originAddress = isset($configuration['origin_address']) ? $configuration['origin_address'] : '';
  $this->useAutocomplete = isset($configuration['use_autocomplete']) ? $configuration['use_autocomplete'] : 0;
  $this->geocoder = $geocoder;
  $this->providerPluginManager = $providerPluginManager;
  $this->options = isset($configuration['settings']['options']) ? $configuration['settings']['options'] : '';
  $this->formatterPluginManager = $formatterPluginManager;
  $this->origin = $this
    ->getAddressOrigin($this->originAddress);
  $this->minTerms = isset($configuration['settings']['autocomplete']['min_terms']) ? $configuration['settings']['autocomplete']['min_terms'] : 4;
  $this->delay = isset($configuration['settings']['autocomplete']['delay']) ? $configuration['settings']['autocomplete']['delay'] : 800;
  $this->addressFormat = isset($configuration['settings']['autocomplete']['address_format']) ? $configuration['settings']['autocomplete']['address_format'] : 'default_formatted_address';
}