Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#11 | 2935360-11.patch | 1.88 KB | Lendude |
Comments
Comment #1
Kirst25Kirst25 created an issue. See original summary.
Comment #2
Kirst25Comment #3
Kirst25Comment #4
cilefen CreditAttribution: cilefen at Institute for Advanced Study commentedI think someone already opened an identical issue.
Comment #5
Kirst25Comment #6
cilefen CreditAttribution: cilefen at Institute for Advanced Study commentedComment #7
mangy.fox CreditAttribution: mangy.fox at Investis Digital commentedHi @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.
Comment #8
mangy.fox CreditAttribution: mangy.fox at Investis Digital commentedI can confirm that the patch applies and works as intended.
Comment #9
cilefen CreditAttribution: cilefen at Institute for Advanced Study commentedFair enough...
Comment #10
borisson_I'm pretty sure this needs tests.
Comment #11
LendudeNow with test.
Comment #13
borisson_That test looks very, very simple! Great work @Lendude.
Comment #14
alexpottIt'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!