In d7, if you attach a feed to a block display, it shows a feed icon below the results. This doesn't work in d8.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

Fix confirmed.

Wim Leers’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Actually, this probably needs test coverage.

olli’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
2 KB
4.25 KB

Here's a test.

The last submitted patch, 3: 2359161-test.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 3: 2359161-3.patch, failed testing.

olli’s picture

Status: Needs work » Needs review
FileSize
1.36 KB
2 KB
3.61 KB

The last submitted patch, 6: 2359161-test.patch, failed testing.

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

Wonderful, thank you!

alexpott’s picture

Status: Reviewed & tested by the community » Needs review
+++ b/core/modules/views/src/ViewExecutable.php
@@ -124,6 +124,13 @@ class ViewExecutable {
+  /**
+   * Feed icons attached to the view.
+   *
+   * @var array
+   */
+  public $feed_icon = array();

The template implies that we only expect one feed icon to be here - not mulitple see views-view-html.html.twig. And this should be a single render array.

damiankloip’s picture

Status: Needs review » Needs work

This works on pages atm because feeds are added to #attached. If you had multiple and they were using the property (as with blocks), it could just keep overwriting the same feed_icon property too. Not the best. So, I think we should rename this to feedIcons and assume everywhere this is an array of feed icon render arrays. We might also want to update the template too, as Alex suggested in #9; this looks like it should just be singular to actually nothing is stopping multiple icons getting rendered in there currently.

Wim Leers’s picture

Great catch. I wonder if an alternative solution is to just change it from an array of feed icon render arrays to just a single feed icon render array? That'd make it very easy to fix this patch.

I guess the worry is then that if there are multiple Feed displays, that only one will be shown. But that's already the case in HEAD, plus it seems very much an edge case. Supporting multiple feed icons feels like a new feature.

olli’s picture

It's a broken feature, it used to work in d7 the same way as attachment_before/after for example. There can be multiple attachments and modules can add more. I'd rather get #6 in to fix the regression and rename things in a separate issue.

olli’s picture

Status: Needs work » Needs review
FileSize
7.63 KB
6.29 KB

Renamed feed_icon to feed_icons/feedIcons.

Status: Needs review » Needs work

The last submitted patch, 13: 2359161-13.patch, failed testing.

olli’s picture

Status: Needs work » Needs review
FileSize
7.62 KB
586 bytes
Wim Leers’s picture

Why did you do the renaming you said you wouldn't do in #12?

olli’s picture

Re #16: Oh, sorry. I didn't mean I was against renaming.

Does #15 address #10?

dawehner’s picture

Priority: Normal » Critical

Should we expand the issue to also fix the icons in pages itself?

damiankloip’s picture

FileSize
7.47 KB

Here is a reroll. I want to see if this does fix what we talked about in the other issue.

EDIT: Yep, certainly works ok. I must have been going crazy Wim!

dawehner’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/core/modules/views/src/ViewExecutable.php
@@ -124,6 +124,13 @@ class ViewExecutable {
+  /**
+   * 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

diff --git a/core/modules/views/templates/views-view.html.twig b/core/modules/views/templates/views-view.html.twig
index f839ef9..5070c42 100644

index f839ef9..5070c42 100644
--- a/core/modules/views/templates/views-view.html.twig

Should we instead try to add a new setter/getter in a follow up?

Wim Leers’s picture

#19: hehe :) np!

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

I think we should change the views twig templates to use a feed_icons class instead of feed_icon in views-view.html.twig and views-view--frontpage.html.twig.

The only css that currently applies to it is in bartik's style.css - and this is not for this div at all - it's for each each themed by feed-icon.html.twig

.feed-icon,
.contextual-links a,
.toolbar a {
  border-bottom: none !important;
}
catch’s picture

Title: Feed icons missing in views blocks » Feed icons missing in views blocks and pages

I think this is the right title now.

damiankloip’s picture

Status: Needs work » Needs review
FileSize
7.53 KB
1.01 KB

Very fair point. Changed.

olli’s picture

Status: Needs review » Reviewed & tested by the community

#24 fixed #22.

catch’s picture

Status: Reviewed & tested by the community » Needs review

Does this need tests for the page display as well?

olli’s picture

FileSize
715 bytes
8.23 KB

Here's a test.

The last submitted patch, 27: 2359161-27-test_only.patch, failed testing.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

I think it is good in the current way. Theoretically introducing setters/getters could be done, but the pure benefit from that
is not much. We already use the public property on the object, so not a big deal to document it and rename it.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This issue addresses a critical bug and is allowed per https://www.drupal.org/core/beta-changes. Committed 15ddad3 and pushed to 8.0.x. Thanks!

  • alexpott committed 15ddad3 on 8.0.x
    Issue #2359161 by olli, damiankloip: Fixed Feed icons missing in views...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.