3 namespace Drupal\views\Plugin\views\style;
8 * Default style plugin to render an OPML feed.
10 * @ingroup views_style_plugins
14 * title = @Translation("OPML Feed"),
15 * help = @Translation("Generates an OPML feed from a view."),
16 * theme = "views_view_opml",
17 * display_types = {"feed"}
20 class Opml extends StylePluginBase {
23 * Does the style plugin for itself support to add fields to its output.
27 protected $usesRowPlugin = TRUE;
32 public function attachTo(array &$build, $display_id, Url $feed_url, $title) {
33 $display = $this->view->displayHandlers->get($display_id);
35 $input = $this->view->getExposedInput();
37 $url_options['query'] = $input;
39 $url_options['absolute'] = TRUE;
41 $url = $feed_url->setOptions($url_options)->toString();
42 if ($display->hasPath()) {
43 if (empty($this->preview)) {
44 $build['#attached']['feed'][] = [$url, $title];
48 $this->view->feedIcons[] = [
49 '#theme' => 'feed_icon',
59 public function render() {
60 if (empty($this->view->rowPlugin)) {
61 debug('Drupal\views\Plugin\views\style\Opml: Missing row plugin');
66 foreach ($this->view->result as $row_index => $row) {
67 $this->view->row_index = $row_index;
68 $rows[] = $this->view->rowPlugin->render($row);
72 '#theme' => $this->themeFunctions(),
73 '#view' => $this->view,
74 '#options' => $this->options,
77 unset($this->view->row_index);