You are here

public function ViewsProximityFilter::getAvailableLocationOptions in Geolocation Field 8.3

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

1 method overrides ViewsProximityFilter::getAvailableLocationOptions()
GeometryViewsProximityFilter::getAvailableLocationOptions in modules/geolocation_geometry/src/Plugin/geolocation/Location/GeometryViewsProximityFilter.php
For one Location (i.e. boundary filter), return all options (all filters).

File

src/Plugin/geolocation/Location/ViewsProximityFilter.php, line 55

Class

ViewsProximityFilter
Derive center from proximity filter.

Namespace

Drupal\geolocation\Plugin\geolocation\Location

Code

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

    /** @var \Drupal\views\Plugin\views\filter\FilterPluginBase $filter */
    foreach ($displayHandler
      ->getHandlers('filter') as $delta => $filter) {
      if ($filter
        ->getPluginId() === 'geolocation_filter_proximity' && $filter !== $context) {
        $options[$delta] = $this
          ->t('Proximity filter') . ' - ' . $filter
          ->adminLabel();
      }
    }
  }
  return $options;
}