class Opml
Same name and namespace in other branches
- 11.x core/modules/views/src/Plugin/views/style/Opml.php \Drupal\views\Plugin\views\style\Opml
- 10 core/modules/views/src/Plugin/views/style/Opml.php \Drupal\views\Plugin\views\style\Opml
- 8.9.x core/modules/views/src/Plugin/views/style/Opml.php \Drupal\views\Plugin\views\style\Opml
Default style plugin to render an OPML feed.
Plugin annotation
@ViewsStyle(
id = "opml",
title = @Translation("OPML Feed"),
help = @Translation("Generates an OPML feed from a view."),
theme = "views_view_opml",
display_types = {"feed"}
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait extends \Drupal\Component\Plugin\PluginBase
- class \Drupal\views\Plugin\views\PluginBase implements \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\views\Plugin\views\ViewsPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface, \Drupal\Core\Security\TrustedCallbackInterface extends \Drupal\Core\Plugin\PluginBase
- class \Drupal\views\Plugin\views\style\StylePluginBase extends \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views\Plugin\views\style\Opml extends \Drupal\views\Plugin\views\style\StylePluginBase
- class \Drupal\views\Plugin\views\style\StylePluginBase extends \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views\Plugin\views\PluginBase implements \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\views\Plugin\views\ViewsPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface, \Drupal\Core\Security\TrustedCallbackInterface extends \Drupal\Core\Plugin\PluginBase
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait extends \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of Opml
Related topics
2 string references to 'Opml'
- views.view.aggregator_sources.yml in core/
modules/ aggregator/ config/ optional/ views.view.aggregator_sources.yml - core/modules/aggregator/config/optional/views.view.aggregator_sources.yml
- views.view.test_aggregator_style_opml.yml in core/
modules/ aggregator/ tests/ modules/ aggregator_test_views/ test_views/ views.view.test_aggregator_style_opml.yml - core/modules/aggregator/tests/modules/aggregator_test_views/test_views/views.view.test_aggregator_style_opml.yml
File
-
core/
modules/ views/ src/ Plugin/ views/ style/ Opml.php, line 20
Namespace
Drupal\views\Plugin\views\styleView source
class Opml extends StylePluginBase {
/**
* {@inheritdoc}
*/
protected $usesRowPlugin = TRUE;
/**
* {@inheritdoc}
*/
public function attachTo(array &$build, $display_id, Url $feed_url, $title) {
$display = $this->view->displayHandlers
->get($display_id);
$url_options = [];
$input = $this->view
->getExposedInput();
if ($input) {
$url_options['query'] = $input;
}
$url_options['absolute'] = TRUE;
$url = $feed_url->setOptions($url_options)
->toString();
if ($display->hasPath()) {
if (empty($this->preview)) {
$build['#attached']['feed'][] = [
$url,
$title,
];
}
}
else {
$this->view->feedIcons[] = [
'#theme' => 'feed_icon',
'#url' => $url,
'#title' => $title,
];
}
}
/**
* {@inheritdoc}
*/
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,
];
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.