You are here

public function ViewsBoundaryArgument::getAvailableLocationOptions in Geolocation Field 8.3

Same name and namespace in other branches
  1. 8.2 src/Plugin/geolocation/Location/ViewsBoundaryArgument.php \Drupal\geolocation\Plugin\geolocation\Location\ViewsBoundaryArgument::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/ViewsBoundaryArgument.php, line 25

Class

ViewsBoundaryArgument
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 $delta => $argument) {
      if ($argument
        ->getPluginId() === 'geolocation_argument_boundary') {
        $options[$delta] = $argument
          ->adminLabel();
      }
    }
  }
  return $options;
}