Issue #3070978 by idebr: Remove early rendering of RSS channel elements in template_preprocess_views_view_rss()
parent
530230fea3
commit
593813261d
|
|
@ -0,0 +1,6 @@
|
|||
name: 'Views Test RSS'
|
||||
type: module
|
||||
description: 'Provides hooks to alter RSS output for testing purposes.'
|
||||
package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?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 {
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = ['block', 'node', 'views'];
|
||||
public static $modules = ['block', 'node', 'views', 'views_test_rss'];
|
||||
|
||||
protected function setUp($import_test_views = TRUE) {
|
||||
parent::setUp($import_test_views);
|
||||
|
|
@ -63,6 +63,7 @@ class DisplayFeedTest extends ViewTestBase {
|
|||
$this->drupalGet('test-feed-display.xml');
|
||||
$this->assertEquals($site_name, $this->getSession()->getDriver()->getText('//title'));
|
||||
$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'));
|
||||
// Verify HTML is properly escaped in the description field.
|
||||
$this->assertRaw('<p>A paragraph</p>');
|
||||
|
|
|
|||
|
|
@ -870,7 +870,7 @@ function template_preprocess_views_view_rss(&$variables) {
|
|||
$variables['langcode'] = \Drupal::languageManager()->getCurrentLanguage()->getId();
|
||||
$variables['namespaces'] = new Attribute($style->namespaces);
|
||||
$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
|
||||
// of the feed are being displayed inside a normal HTML page.
|
||||
|
|
|
|||
Loading…
Reference in New Issue