You are here

public function GeocodeOrigin::getEnabledProviderPlugins in Geocoder 8.3

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

Get the list of enabled Provider plugins.

Return value

array Provider plugin IDs and their properties (id, name, arguments...).

2 calls to GeocodeOrigin::getEnabledProviderPlugins()
GeocodeOrigin::buildOptionsForm in src/Plugin/GeofieldProximitySource/GeocodeOrigin.php
Builds the specific form elements for the geofield proximity plugin.
GeocodeOrigin::getAddressOrigin in src/Plugin/GeofieldProximitySource/GeocodeOrigin.php
Geocode the Origin Address.

File

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

Class

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

Namespace

Drupal\geocoder\Plugin\GeofieldProximitySource

Code

public function getEnabledProviderPlugins() {
  $geocoder_plugins = $this->providerPluginManager
    ->getPlugins();
  $plugins_settings = isset($this->configuration['plugins']) ? $this->configuration['plugins'] : [];

  // Filter out unchecked plugins.
  $provider_plugin_ids = array_filter($plugins_settings, function ($plugin) {
    return isset($plugin['checked']) && $plugin['checked'] == TRUE;
  });
  $provider_plugin_ids = array_combine(array_keys($provider_plugin_ids), array_keys($provider_plugin_ids));
  foreach ($geocoder_plugins as $plugin) {
    if (isset($provider_plugin_ids[$plugin['id']])) {
      $provider_plugin_ids[$plugin['id']] = $plugin;
    }
  }
  return $provider_plugin_ids;
}