function OpmlFields::validate

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

Overrides PluginBase::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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.