summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2014-11-11 13:03:28 -0800
committerAlex Pott2014-11-11 13:03:28 -0800
commit15ddad3bf498b0e8bdfe7724e1dbaf653c2d7885 (patch)
treea2957d930f67c135d173883acba31e8723e53e8a
parent29817e452acf487b1579c5f2db93f1ce7ba57f9c (diff)
Issue #2359161 by olli, damiankloip: Fixed Feed icons missing in views blocks and pages.8.0.0-beta3
-rw-r--r--core/modules/views/src/Plugin/views/display/DisplayPluginBase.php4
-rw-r--r--core/modules/views/src/Plugin/views/display/Feed.php3
-rw-r--r--core/modules/views/src/Plugin/views/style/Opml.php3
-rw-r--r--core/modules/views/src/Plugin/views/style/Rss.php2
-rw-r--r--core/modules/views/src/Tests/Plugin/DisplayFeedTest.php12
-rw-r--r--core/modules/views/src/Tests/Wizard/BasicTest.php1
-rw-r--r--core/modules/views/src/ViewExecutable.php7
-rw-r--r--core/modules/views/templates/views-view.html.twig8
-rw-r--r--core/modules/views/tests/modules/views_test_data/templates/views-view--frontpage.html.twig8
-rw-r--r--core/modules/views/views.module2
10 files changed, 36 insertions, 14 deletions
diff --git a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
index c5a8d37..04b3b78 100644
--- a/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
+++ b/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php
@@ -2178,7 +2178,7 @@ abstract class DisplayPluginBase extends PluginBase {
$element['#empty'] = $empty ? $view->display_handler->renderArea('empty', $empty) : array();
$element['#exposed'] = !empty($view->exposed_widgets) ? $view->exposed_widgets : array();
$element['#more'] = $view->display_handler->renderMoreLink();
- $element['#feed_icon'] = !empty($view->feed_icon) ? $view->feed_icon : array();
+ $element['#feed_icons'] = !empty($view->feedIcons) ? $view->feedIcons : array();
if ($view->display_handler->renderPager()) {
$exposed_input = isset($view->exposed_raw_input) ? $view->exposed_raw_input : NULL;
@@ -2213,7 +2213,7 @@ abstract class DisplayPluginBase extends PluginBase {
$element['#pager'] = array();
$element['#footer'] = array();
$element['#more'] = array();
- $element['#feed_icon'] = array();
+ $element['#feed_icons'] = array();
}
$element['#rows'] = $form;
diff --git a/core/modules/views/src/Plugin/views/display/Feed.php b/core/modules/views/src/Plugin/views/display/Feed.php
index 7d1c5fe..67171ab 100644
--- a/core/modules/views/src/Plugin/views/display/Feed.php
+++ b/core/modules/views/src/Plugin/views/display/Feed.php
@@ -269,6 +269,9 @@ class Feed extends PathPluginBase {
$clone->buildTitle();
if ($plugin = $clone->display_handler->getPlugin('style')) {
$plugin->attachTo($build, $display_id, $this->getPath(), $clone->getTitle());
+ foreach ($clone->feedIcons as $feed_icon) {
+ $this->view->feedIcons[] = $feed_icon;
+ }
}
// Clean up.
diff --git a/core/modules/views/src/Plugin/views/style/Opml.php b/core/modules/views/src/Plugin/views/style/Opml.php
index 229e4c2..f41378f 100644
--- a/core/modules/views/src/Plugin/views/style/Opml.php
+++ b/core/modules/views/src/Plugin/views/style/Opml.php
@@ -48,12 +48,11 @@ class Opml extends StylePluginBase {
}
}
else {
- $feed_icon = array(
+ $this->view->feedIcons[] = array(
'#theme' => 'feed_icon',
'#url' => $url,
'#title' => $title,
);
- $this->view->feed_icon = $feed_icon;
}
}
diff --git a/core/modules/views/src/Plugin/views/style/Rss.php b/core/modules/views/src/Plugin/views/style/Rss.php
index d40acf2..f597116 100644
--- a/core/modules/views/src/Plugin/views/style/Rss.php
+++ b/core/modules/views/src/Plugin/views/style/Rss.php
@@ -43,7 +43,7 @@ class Rss extends StylePluginBase {
$url = _url($this->view->getUrl(NULL, $path), $url_options);
// Add the RSS icon to the view.
- $this->view->feed_icon = [
+ $this->view->feedIcons[] = [
'#theme' => 'feed_icon',
'#url' => $url,
'#title' => $title,
diff --git a/core/modules/views/src/Tests/Plugin/DisplayFeedTest.php b/core/modules/views/src/Tests/Plugin/DisplayFeedTest.php
index 7df3e31..97e6e99 100644
--- a/core/modules/views/src/Tests/Plugin/DisplayFeedTest.php
+++ b/core/modules/views/src/Tests/Plugin/DisplayFeedTest.php
@@ -42,6 +42,7 @@ class DisplayFeedTest extends PluginTestBase {
* Tests the rendered output.
*/
public function testFeedOutput() {
+ $this->drupalCreateContentType(['type' => 'page']);
$this->drupalCreateNode();
// Test the site name setting.
@@ -60,6 +61,17 @@ class DisplayFeedTest extends PluginTestBase {
$this->drupalGet('test-feed-display.xml');
$result = $this->xpath('//title');
$this->assertEqual($result[0], 'test_display_feed', 'The display title is used for the feed title.');
+
+ // Add a block display and attach the feed.
+ $view->getExecutable()->newDisplay('block', NULL, 'test');
+ $display = &$view->getDisplay('feed_1');
+ $display['display_options']['displays']['test'] = 'test';
+ $view->save();
+ // Test the feed display adds a feed icon to the block display.
+ $this->drupalPlaceBlock('views_block:test_display_feed-test');
+ $this->drupalGet('<front>');
+ $feed_icon = $this->cssSelect('div.view-id-test_display_feed a.feed-icon');
+ $this->assertTrue(strpos($feed_icon[0]['href'], 'test-feed-display.xml'), 'The feed icon was found.');
}
}
diff --git a/core/modules/views/src/Tests/Wizard/BasicTest.php b/core/modules/views/src/Tests/Wizard/BasicTest.php
index 7bb0f81..32f83c1 100644
--- a/core/modules/views/src/Tests/Wizard/BasicTest.php
+++ b/core/modules/views/src/Tests/Wizard/BasicTest.php
@@ -74,6 +74,7 @@ class BasicTest extends WizardTestBase {
$this->assertText($node2->label());
// Check if we have the feed.
+ $this->assertLinkByHref(_url($view2['page[feed_properties][path]']));
$elements = $this->cssSelect('link[href="' . _url($view2['page[feed_properties][path]'], ['absolute' => TRUE]) . '"]');
$this->assertEqual(count($elements), 1, 'Feed found.');
$this->drupalGet($view2['page[feed_properties][path]']);
diff --git a/core/modules/views/src/ViewExecutable.php b/core/modules/views/src/ViewExecutable.php
index fc32dc4..9214808 100644
--- a/core/modules/views/src/ViewExecutable.php
+++ b/core/modules/views/src/ViewExecutable.php
@@ -125,6 +125,13 @@ class ViewExecutable {
*/
public $attachment_after = array();
+ /**
+ * Feed icons attached to the view.
+ *
+ * @var array
+ */
+ public $feedIcons = array();
+
// Exposed widget input
/**
diff --git a/core/modules/views/templates/views-view.html.twig b/core/modules/views/templates/views-view.html.twig
index f839ef9..46c7e0a 100644
--- a/core/modules/views/templates/views-view.html.twig
+++ b/core/modules/views/templates/views-view.html.twig
@@ -20,7 +20,7 @@
* - empty: The content to display if there are no rows.
* - pager: The optional pager next/prev links to display.
* - exposed: Exposed widget form/info to display.
- * - feed_icon: An optional feed icon to display.
+ * - feed_icons: Optional feed icons to display.
* - more: An optional link to the next page of results.
* - title: Title of the view, only used when displaying in the admin preview.
* - title_prefix: Additional output populated by modules, intended to be
@@ -85,9 +85,9 @@
{{ footer }}
</div>
{% endif %}
- {% if feed_icon %}
- <div class="feed-icon">
- {{ feed_icon }}
+ {% if feed_icons %}
+ <div class="feed-icons">
+ {{ feed_icons }}
</div>
{% endif %}
</div>
diff --git a/core/modules/views/tests/modules/views_test_data/templates/views-view--frontpage.html.twig b/core/modules/views/tests/modules/views_test_data/templates/views-view--frontpage.html.twig
index 0ccf2da..1d7ae51 100644
--- a/core/modules/views/tests/modules/views_test_data/templates/views-view--frontpage.html.twig
+++ b/core/modules/views/tests/modules/views_test_data/templates/views-view--frontpage.html.twig
@@ -20,7 +20,7 @@
* - empty: The content to display if there are no rows.
* - pager: The optional pager next/prev links to display.
* - exposed: Exposed widget form/info to display.
- * - feed_icon: An optional feed icon to display.
+ * - feed_icons: Optional feed icons to display.
* - more: An optional link to the next page of results.
* - title: Title of the view, only used when displaying in the admin preview.
* - title_prefix: Additional output populated by modules, intended to be
@@ -80,9 +80,9 @@
{{ footer }}
</div>
{% endif %}
- {% if feed_icon %}
- <div class="feed-icon">
- {{ feed_icon }}
+ {% if feed_icons %}
+ <div class="feed-icons">
+ {{ feed_icons }}
</div>
{% endif %}
</div>
diff --git a/core/modules/views/views.module b/core/modules/views/views.module
index 02e9f52..c216872 100644
--- a/core/modules/views/views.module
+++ b/core/modules/views/views.module
@@ -110,7 +110,7 @@ function views_theme($existing, $type, $theme, $path) {
'empty' => array(),
'exposed' => array(),
'more' => array(),
- 'feed_icon' => array(),
+ 'feed_icons' => array(),
'pager' => array(),
'title' => '',
'attachment_before' => array(),