You are here

public function ViewsProximityArgument::getAvailableLocationOptions in Geolocation Field 8.3

Same name and namespace in other branches
  1. 8.2 src/Plugin/geolocation/Location/ViewsProximityArgument.php \Drupal\geolocation\Plugin\geolocation\Location\ViewsProximityArgument::getAvailableLocationOptions()

For one Location (i.e. boundary filter), return all options (all filters).

Parameters

mixed $context: Context like field formatter, field widget or view.

Return value

array Available location options indexed by ID.

Overrides LocationBase::getAvailableLocationOptions

File

src/Plugin/geolocation/Location/ViewsProximityArgument.php, line 25

Class

ViewsProximityArgument
Derive center from proximity argument.

Namespace

Drupal\geolocation\Plugin\geolocation\Location

Code

public function getAvailableLocationOptions($context) {
  $options = [];
  if ($displayHandler = self::getViewsDisplayHandler($context)) {

    /** @var \Drupal\views\Plugin\views\argument\ArgumentPluginBase $argument */
    foreach ($displayHandler
      ->getHandlers('argument') as $argument_id => $argument) {
      if ($argument
        ->getPluginId() == 'geolocation_argument_proximity') {
        $options[$argument_id] = $this
          ->t('Proximity argument') . ' - ' . $argument
          ->adminLabel();
      }
    }
  }
  return $options;
}