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 {
25 protected $usesRowPlugin = TRUE;
30 public function attachTo(array &$build, $display_id, Url $feed_url, $title) {
31 $display = $this->view->displayHandlers->get($display_id);
33 $input = $this->view->getExposedInput();
35 $url_options['query'] = $input;
37 $url_options['absolute'] = TRUE;
39 $url = $feed_url->setOptions($url_options)->toString();
40 if ($display->hasPath()) {
41 if (empty($this->preview)) {
42 $build['#attached']['feed'][] = [$url, $title];
46 $this->view->feedIcons[] = [
47 '#theme' => 'feed_icon',
57 public function render() {
58 if (empty($this->view->rowPlugin)) {
59 debug('Drupal\views\Plugin\views\style\Opml: Missing row plugin');
64 foreach ($this->view->result as $row_index => $row) {
65 $this->view->row_index = $row_index;
66 $rows[] = $this->view->rowPlugin->render($row);
70 '#theme' => $this->themeFunctions(),
71 '#view' => $this->view,
72 '#options' => $this->options,
75 unset($this->view->row_index);