You are here

public static function GeocodeOrigin::validatePluginsSettingsForm in Geocoder 8.3

Same name and namespace in other branches
  1. 8.2 src/Plugin/GeofieldProximitySource/GeocodeOrigin.php \Drupal\geocoder\Plugin\GeofieldProximitySource\GeocodeOrigin::validatePluginsSettingsForm()

File

src/Plugin/GeofieldProximitySource/GeocodeOrigin.php, line 346

Class

GeocodeOrigin
Defines 'Geocode Origin (with Autocomplete option)' proximity source plugin.

Namespace

Drupal\geocoder\Plugin\GeofieldProximitySource

Code

public static function validatePluginsSettingsForm(array $element, FormStateInterface &$form_state) {
  $plugins = is_array($element['#value']) ? array_filter($element['#value'], function ($value) {
    return isset($value['checked']) && TRUE == $value['checked'];
  }) : [];
  if (empty($plugins)) {
    $form_state
      ->setError($element, t('The Geocode Origin option needs at least one geocoder plugin selected.'));
  }
}