function ViewsThemeHooks::preprocessViewsViewOpml
Prepares variables for OPML feed templates.
Default template: views-view-opml.html.twig.
Parameters
array $variables: An associative array containing:
- view: A ViewExecutable object.
- rows: The raw row data.
File
-
core/
modules/ views/ src/ Hook/ ViewsThemeHooks.php, line 1202
Class
- ViewsThemeHooks
- Hook implementations for views.
Namespace
Drupal\views\HookCode
public function preprocessViewsViewOpml(array &$variables) : void {
$view = $variables['view'];
$items = $variables['rows'];
$config = $this->configFactory
->get('system.site');
if ($view->display_handler
->getOption('sitename_title')) {
$title = $config->get('name');
if ($slogan = $config->get('slogan')) {
$title .= ' - ' . $slogan;
}
}
else {
$title = $view->getTitle();
}
$variables['title'] = $title;
$variables['items'] = $items;
$variables['updated'] = gmdate(DATE_RFC2822, $this->time
->getRequestTime());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.