Displays an empty container when selected views block doesn't have result in the block field.

Created on 19 September 2017, almost 7 years ago
Updated 21 February 2024, 4 months ago

Problem/Motivation

Discovered this issue when selected views blocks don't have any result but "div" container still displays for each of this block which caused UI bugs.

Proposed resolution

Just add an additional condition to skip views block with empty content too.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine SV

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States Greg Boggs Portland Oregon

    With the patch in #4 , I was able to get clean markup, however, when a view has no result, there's still bits in the array, so field group detects that it has content and still prints field groups around the empty fields even though there is no markup.

  • πŸ‡§πŸ‡ͺBelgium herved

    @Greg Boggs I think you can avoid this by checking the "Hide block if the view output is empty" option which affects the block render array returned by \Drupal\views\Plugin\views\display\Block::execute
    The last patch doesn't look right to me.

  • πŸ‡ΊπŸ‡ΈUnited States Greg Boggs Portland Oregon

    ha, yes, you are correct! I should have thought of that. Using views options is much better than my patch.

  • πŸ‡ΊπŸ‡ΈUnited States Greg Boggs Portland Oregon

    The hide view when empty setting does not work unfortunately. My patch in 6 does work, but it would be much better if block field respected the hide if empty setting instead of checking for no results.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update 4 months ago
    5 pass, 2 fail
Production build 0.69.0 2024