You are here

public function GeometryViewsProximityFilter::getAvailableLocationOptions in Geolocation Field 8.3

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 ViewsProximityFilter::getAvailableLocationOptions

File

modules/geolocation_geometry/src/Plugin/geolocation/Location/GeometryViewsProximityFilter.php, line 21

Class

GeometryViewsProximityFilter
Derive center from proximity filter.

Namespace

Drupal\geolocation_geometry\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_geometry_filter_proximity' && $filter !== $context) {
        $options[$delta] = $this
          ->t('Geo Proximity filter') . ' - ' . $filter
          ->adminLabel();
      }
    }
  }
  return $options;
}