Issue #1843760 by webthingee, joelpittet, jpamental: Convert views/templates/views-view-rss.tpl.php to twig.
parent
7016229fc1
commit
a312df8cda
|
@ -0,0 +1,31 @@
|
|||
{#
|
||||
/**
|
||||
* @file
|
||||
* Default template for feed displays that use the RSS style.
|
||||
*
|
||||
* Available variables:
|
||||
* - link: The link to the feed (the view path).
|
||||
* - namespaces: The XML namespaces (added automatically).
|
||||
* - title: The title of the feed (as set in the view).
|
||||
* - description: The feed description (from feed settings).
|
||||
* - langcode: The language encoding.
|
||||
* - channel_elements: The formatted channel elements.
|
||||
* - items: The feed items themselves.
|
||||
*
|
||||
* @see template_preprocess()
|
||||
* @see template_preprocess_views_view_rss()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
#}
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<rss version="2.0" xml:base="{{ link }}"{{ namespaces }}>
|
||||
<channel>
|
||||
<title>{{ title }}</title>
|
||||
<link>{{ link }}</link>
|
||||
<description>{{ description }}</description>
|
||||
<language>{{ langcode }}</language>
|
||||
{{ channel_elements }}
|
||||
{{ items }}
|
||||
</channel>
|
||||
</rss>
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Default template for feed displays that use the RSS style.
|
||||
*
|
||||
* @ingroup views_templates
|
||||
*/
|
||||
?>
|
||||
<?php print "<?xml"; ?> version="1.0" encoding="utf-8" <?php print "?>"; ?>
|
||||
<rss version="2.0" xml:base="<?php print $link; ?>"<?php print $namespaces; ?>>
|
||||
<channel>
|
||||
<title><?php print $title; ?></title>
|
||||
<link><?php print $link; ?></link>
|
||||
<description><?php print $description; ?></description>
|
||||
<language><?php print $langcode; ?></language>
|
||||
<?php print $channel_elements; ?>
|
||||
<?php print $items; ?>
|
||||
</channel>
|
||||
</rss>
|
|
@ -846,16 +846,22 @@ function template_preprocess_views_view_list(&$vars) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Preprocess an RSS feed
|
||||
*/
|
||||
* Prepares variables for RSS feed templates.
|
||||
*
|
||||
* Default template: views-view-rss.html.twig.
|
||||
*
|
||||
* @param array $vars
|
||||
* An associative array containing:
|
||||
* - view: A ViewExecutable object.
|
||||
* - rows: The raw row data.
|
||||
*/
|
||||
function template_preprocess_views_view_rss(&$vars) {
|
||||
global $base_url;
|
||||
|
||||
$view = &$vars['view'];
|
||||
$options = &$vars['options'];
|
||||
$items = &$vars['rows'];
|
||||
$view = $vars['view'];
|
||||
$items = $vars['rows'];
|
||||
|
||||
$style = &$view->style_plugin;
|
||||
$style = $view->style_plugin;
|
||||
|
||||
$config = config('system.site');
|
||||
|
||||
|
@ -875,8 +881,8 @@ function template_preprocess_views_view_rss(&$vars) {
|
|||
}
|
||||
$vars['title'] = check_plain($title);
|
||||
|
||||
// Figure out which display which has a path we're using for this feed. If there isn't
|
||||
// one, use the global $base_url
|
||||
// Figure out which display which has a path we're using for this feed. If
|
||||
// there isn't one, use the global $base_url
|
||||
$link_display_id = $view->display_handler->getLinkDisplay();
|
||||
if ($link_display_id && $display = $view->displayHandlers->get($link_display_id)) {
|
||||
$path = $view->displayHandlers->get($link_display_id)->getPath();
|
||||
|
@ -889,7 +895,8 @@ function template_preprocess_views_view_rss(&$vars) {
|
|||
$url_options['query'] = $view->exposed_raw_input;
|
||||
}
|
||||
|
||||
// Compare the link to the default home page; if it's the default home page, just use $base_url.
|
||||
// Compare the link to the default home page; if it's the default home page,
|
||||
// just use $base_url.
|
||||
if ($path == $config->get('page.front')) {
|
||||
$path = '';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue