Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. OpmlFields.php

function OpmlFields::validate

Overrides PluginBase::validate

File

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

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal