You are here

public function Leaflet::validate in Leaflet 8

Same name and namespace in other branches
  1. 2.1.x modules/leaflet_views/src/Plugin/views/style/Leaflet.php \Drupal\leaflet_views\Plugin\views\style\Leaflet::validate()
  2. 2.0.x modules/leaflet_views/src/Plugin/views/style/Leaflet.php \Drupal\leaflet_views\Plugin\views\style\Leaflet::validate()

Validate that the plugin is correct and can be saved.

Return value

An array of error strings to tell the user what is wrong with this plugin.

Overrides StylePluginBase::validate

File

modules/leaflet_views/src/Plugin/views/style/Leaflet.php, line 238

Class

Leaflet
Style plugin to render a View output as a Leaflet map.

Namespace

Drupal\leaflet_views\Plugin\views\style

Code

public function validate() {
  $errors = parent::validate();
  if (empty($this->options['map'])) {
    $errors[] = $this
      ->t('Style @style requires a leaflet map to be configured.', [
      '@style' => $this->definition['title'],
    ]);
  }
  return $errors;
}