diff --git a/core/modules/file/src/Tests/FileFieldRSSContentTest.php b/core/modules/file/src/Tests/FileFieldRSSContentTest.php index 7f04ac2..56400a8 100644 --- a/core/modules/file/src/Tests/FileFieldRSSContentTest.php +++ b/core/modules/file/src/Tests/FileFieldRSSContentTest.php @@ -68,15 +68,12 @@ function testFileFieldRSSContent() { // Check that the RSS enclosure appears in the RSS feed. $this->drupalGet('rss.xml'); $uploaded_filename = str_replace('public://', '', $node_file->getFileUri()); - $test_element = array( - 'key' => 'enclosure', - 'value' => "", - 'attributes' => array( - 'url' => file_create_url("public://$uploaded_filename", array('absolute' => TRUE)), - 'length' => $node_file->getSize(), - 'type' => $node_file->getMimeType() - ), + $test_element = sprintf( + '', + file_create_url("public://$uploaded_filename", array('absolute' => TRUE)), + $node_file->getSize(), + $node_file->getMimeType() ); - $this->assertRaw(format_xml_elements(array($test_element)), 'File field RSS enclosure is displayed when viewing the RSS feed.'); + $this->assertRaw($test_element, 'File field RSS enclosure is displayed when viewing the RSS feed.'); } } diff --git a/core/modules/node/src/Tests/NodeRSSContentTest.php b/core/modules/node/src/Tests/NodeRSSContentTest.php index e4b7cb3..6deb8af 100644 --- a/core/modules/node/src/Tests/NodeRSSContentTest.php +++ b/core/modules/node/src/Tests/NodeRSSContentTest.php @@ -54,12 +54,9 @@ function testNodeRSSContent() { $this->assertNoText($non_rss_content, 'Node content not designed for RSS does not appear in RSS feed.'); // Check that extra RSS elements and namespaces are added to RSS feed. - $test_element = array( - 'key' => 'testElement', - 'value' => t('Value of testElement RSS element for node !nid.', array('!nid' => $node->id())), - ); + $test_element = '' . t('Value of testElement RSS element for node !nid.', array('!nid' => $node->id())) . ''; $test_ns = 'xmlns:drupaltest="http://example.com/test-namespace"'; - $this->assertRaw(format_xml_elements(array($test_element)), 'Extra RSS elements appear in RSS feed.'); + $this->assertRaw($test_element, 'Extra RSS elements appear in RSS feed.'); $this->assertRaw($test_ns, 'Extra namespaces appear in RSS feed.'); // Check that content added in 'rss' view mode doesn't appear when diff --git a/core/modules/taxonomy/src/Tests/RssTest.php b/core/modules/taxonomy/src/Tests/RssTest.php index 7fa3f10..98890a0 100644 --- a/core/modules/taxonomy/src/Tests/RssTest.php +++ b/core/modules/taxonomy/src/Tests/RssTest.php @@ -97,14 +97,12 @@ function testTaxonomyRss() { // Check that the term is displayed when the RSS feed is viewed. $this->drupalGet('rss.xml'); - $test_element = array( - 'key' => 'category', - 'value' => $term1->getName(), - 'attributes' => array( - 'domain' => $term1->url('canonical', array('absolute' => TRUE)), - ), + $test_element = sprintf( + '%s', + 'domain="' . $term1->url('canonical', array('absolute' => TRUE)) . '"', + $term1->getName() ); - $this->assertRaw(format_xml_elements(array($test_element)), 'Term is displayed when viewing the rss feed.'); + $this->assertRaw($test_element, 'Term is displayed when viewing the rss feed.'); // Test that the feed page exists for the term. $this->drupalGet("taxonomy/term/{$term1->id()}/feed"); @@ -121,12 +119,9 @@ function testTaxonomyRss() { $view->storage->save(); // Check the article is shown in the feed. $node = $this->drupalGetNodeByTitle($edit['title[0][value]']); - $raw_xml = format_xml_elements([[ - 'key' => 'title', - 'value' => $node->label(), - ]]); + $raw_xml = '' . $node->label() . ''; $this->drupalGet('taxonomy/term/all/feed'); - $this->assertRaw($raw_xml); + $this->assertRaw($raw_xml, "Raw text '$raw_xml' is found."); // Unpublish the article and check that it is not shown in the feed. $node->setPublished(FALSE)->save(); $this->drupalGet('taxonomy/term/all/feed'); diff --git a/core/modules/views/src/Plugin/views/style/Rss.php b/core/modules/views/src/Plugin/views/style/Rss.php index fbbf4dd..274c5be 100644 --- a/core/modules/views/src/Plugin/views/style/Rss.php +++ b/core/modules/views/src/Plugin/views/style/Rss.php @@ -83,7 +83,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { * Return an array of additional XHTML elements to add to the channel. * * @return - * An array that can be passed to format_xml_elements(). + * A render array. */ protected function getChannelElements() { return array(); diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc index d512b1d..7a75027 100644 --- a/core/modules/views/views.theme.inc +++ b/core/modules/views/views.theme.inc @@ -895,7 +895,7 @@ function template_preprocess_views_view_rss(&$variables) { $variables['langcode'] = SafeMarkup::checkPlain(\Drupal::languageManager()->getCurrentLanguage()->getId()); $variables['namespaces'] = new Attribute($style->namespaces); $variables['items'] = $items; - $variables['channel_elements'] = format_xml_elements($style->channel_elements); + $variables['channel_elements'] = \Drupal::service('renderer')->render($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.