When adding a Global: Result summary to a View block as header/footer, when the View has no results and header/footer is not set to show all the time it renders an empty header/footer area in the view.

Proposed solution:
If the results summary output is empty it shouldn't render the results array.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Kirst25’s picture

Kirst25 created an issue. See original summary.

Kirst25’s picture

Kirst25’s picture

Status: Needs work » Needs review
cilefen’s picture

I think someone already opened an identical issue.

Kirst25’s picture

Assigned: Kirst25 » Unassigned
cilefen’s picture

mangy.fox’s picture

Hi @cilefen, that issue appears to be unrelated to this one - to do with the way twig is parsed in the text area plugin. This issue is specifically to do with the Result Summary plugin, and the way it returns a render array even when there are no results.

mangy.fox’s picture

I can confirm that the patch applies and works as intended.

cilefen’s picture

Fair enough...

borisson_’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

I'm pretty sure this needs tests.

Lendude’s picture

Version: 8.4.4 » 8.5.x-dev
Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
1.15 KB
1.88 KB

Now with test.

The last submitted patch, 11: 2935360-11-TEST_ONLY.patch, failed testing. View results

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

That test looks very, very simple! Great work @Lendude.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

It'd be good to document the need to result an empty array on the abstract method ie. \Drupal\views\Plugin\views\area\AreaPluginBase::render(). Can we open a followup to do that?

Committed and pushed 59eb794a25 to 8.6.x and cf81f0ee8a to 8.5.x. Thanks!

  • alexpott committed 59eb794 on 8.6.x
    Issue #2935360 by Lendude, Kirst25: Views result summary still renders...

  • alexpott committed cf81f0e on 8.5.x
    Issue #2935360 by Lendude, Kirst25: Views result summary still renders...

Status: Fixed » Closed (fixed)

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