function Opml::render

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

Render the display in this style.

Overrides StylePluginBase::render

File

core/modules/views/src/Plugin/views/style/Opml.php, line 58

Class

Opml
Default style plugin to render an OPML feed.

Namespace

Drupal\views\Plugin\views\style

Code

public function render() {
  $rows = [];
  foreach ($this->view->result as $row_index => $row) {
    $this->view->row_index = $row_index;
    $rows[] = $this->view->rowPlugin
      ->render($row);
  }
  $build = [
    '#theme' => $this->themeFunctions(),
    '#view' => $this->view,
    '#options' => $this->options,
    '#rows' => $rows,
    '#attached' => [
      'http_header' => [
        [
          'Content-Type',
          'text/xml; charset=utf-8',
        ],
      ],
    ],
  ];
  unset($this->view->row_index);
  return $build;
}

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