You are here

public function ViewsBoundaryArgument::getAvailableMapCenterOptions in Geolocation Field 8.3

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

Class

ViewsBoundaryArgument
Derive center from boundary filter.

Namespace

Drupal\geolocation\Plugin\geolocation\MapCenter

Code

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

    /** @var \Drupal\views\Plugin\views\HandlerBase $context */

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