public function ViewsBoundaryFilter::getAvailableMapCenterOptions in Geolocation Field 8.2
Same name and namespace in other branches
- 8.3 src/Plugin/geolocation/MapCenter/ViewsBoundaryFilter.php \Drupal\geolocation\Plugin\geolocation\MapCenter\ViewsBoundaryFilter::getAvailableMapCenterOptions()
For one MapCenter (i.e. boundary filter), return all options (all filters).
Parameters
mixed $context: Context like field formatter, field widget or view.
Return value
array Available center options indexed by ID.
Overrides MapCenterBase::getAvailableMapCenterOptions
File
- src/
Plugin/ geolocation/ MapCenter/ ViewsBoundaryFilter.php, line 25
Class
- ViewsBoundaryFilter
- Derive center from boundary filter.
Namespace
Drupal\geolocation\Plugin\geolocation\MapCenterCode
public function getAvailableMapCenterOptions($context) {
$options = [];
if ($displayHandler = self::getViewsDisplayHandler($context)) {
/** @var \Drupal\views\Plugin\views\filter\FilterPluginBase $filter */
foreach ($displayHandler
->getHandlers('filter') as $filter_id => $filter) {
if ($filter
->getPluginId() == 'geolocation_filter_boundary') {
// Preserve compatibility to v1.
$options['boundary_filter_' . $filter_id] = $this
->t('Boundary filter') . ' - ' . $filter
->adminLabel();
}
}
}
return $options;
}