Skip to content
Snippets Groups Projects
Verified Commit 59381326 authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3070978 by idebr: Remove early rendering of RSS channel elements in...

Issue #3070978 by idebr: Remove early rendering of RSS channel elements in template_preprocess_views_view_rss()
parent 530230fe
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
name: 'Views Test RSS'
type: module
description: 'Provides hooks to alter RSS output for testing purposes.'
package: Testing
version: VERSION
core: 8.x
<?php
/**
* @file
* Hook implementations for this module.
*/
/**
* Implements hook_preprocess_HOOK().
*/
function views_test_rss_preprocess_views_view_rss(&$variables) {
$variables['channel_elements'][] = [
'#type' => 'html_tag',
'#tag' => 'copyright',
'#value' => t('Copyright 2019 Dries Buytaert'),
];
}
...@@ -26,7 +26,7 @@ class DisplayFeedTest extends ViewTestBase { ...@@ -26,7 +26,7 @@ class DisplayFeedTest extends ViewTestBase {
* *
* @var array * @var array
*/ */
public static $modules = ['block', 'node', 'views']; public static $modules = ['block', 'node', 'views', 'views_test_rss'];
protected function setUp($import_test_views = TRUE) { protected function setUp($import_test_views = TRUE) {
parent::setUp($import_test_views); parent::setUp($import_test_views);
...@@ -63,6 +63,7 @@ public function testFeedOutput() { ...@@ -63,6 +63,7 @@ public function testFeedOutput() {
$this->drupalGet('test-feed-display.xml'); $this->drupalGet('test-feed-display.xml');
$this->assertEquals($site_name, $this->getSession()->getDriver()->getText('//title')); $this->assertEquals($site_name, $this->getSession()->getDriver()->getText('//title'));
$this->assertEquals($frontpage_url, $this->getSession()->getDriver()->getText('//link')); $this->assertEquals($frontpage_url, $this->getSession()->getDriver()->getText('//link'));
$this->assertEquals('Copyright 2019 Dries Buytaert', $this->getSession()->getDriver()->getText('//channel/copyright'));
$this->assertEquals($node_title, $this->getSession()->getDriver()->getText('//item/title')); $this->assertEquals($node_title, $this->getSession()->getDriver()->getText('//item/title'));
// Verify HTML is properly escaped in the description field. // Verify HTML is properly escaped in the description field.
$this->assertRaw('&lt;p&gt;A paragraph&lt;/p&gt;'); $this->assertRaw('&lt;p&gt;A paragraph&lt;/p&gt;');
......
...@@ -870,7 +870,7 @@ function template_preprocess_views_view_rss(&$variables) { ...@@ -870,7 +870,7 @@ function template_preprocess_views_view_rss(&$variables) {
$variables['langcode'] = \Drupal::languageManager()->getCurrentLanguage()->getId(); $variables['langcode'] = \Drupal::languageManager()->getCurrentLanguage()->getId();
$variables['namespaces'] = new Attribute($style->namespaces); $variables['namespaces'] = new Attribute($style->namespaces);
$variables['items'] = $items; $variables['items'] = $items;
$variables['channel_elements'] = \Drupal::service('renderer')->render($style->channel_elements); $variables['channel_elements'] = $style->channel_elements;
// During live preview we don't want to output the header since the contents // During live preview we don't want to output the header since the contents
// of the feed are being displayed inside a normal HTML page. // of the feed are being displayed inside a normal HTML page.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment