You are here

public function OpmlFields::validate in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/row/OpmlFields.php \Drupal\views\Plugin\views\row\OpmlFields::validate()
  2. 9 core/modules/views/src/Plugin/views/row/OpmlFields.php \Drupal\views\Plugin\views\row\OpmlFields::validate()

File

core/modules/views/src/Plugin/views/row/OpmlFields.php, line 149

Class

OpmlFields
Renders an OPML item based on fields.

Namespace

Drupal\views\Plugin\views\row

Code

public function validate() {
  $errors = parent::validate();
  if (empty($this->options['text_field'])) {
    $errors[] = $this
      ->t('Row style plugin requires specifying which views field to use for OPML text attribute.');
  }
  if (!empty($this->options['type_field'])) {
    if ($this->options['type_field'] == 'rss') {
      if (empty($this->options['xml_url_field'])) {
        $errors[] = $this
          ->t('Row style plugin requires specifying which views field to use for XML URL attribute.');
      }
    }
    elseif (in_array($this->options['type_field'], [
      'link',
      'include',
    ])) {
      if (empty($this->options['url_field'])) {
        $errors[] = $this
          ->t('Row style plugin requires specifying which views field to use for URL attribute.');
      }
    }
  }
  return $errors;
}