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.
Now that I've hierarchically placed some galleries under top level galleries (which act as containers and have no images of their own), both the container galleries, as well as the subgalleries now each display an empty view:
- The top level galleries have no images, so their own gallery view is empty
- The subgalleries have no subgalleries of their own, so the subgalleries view is empty
Any tips on how to handle this? I've been trying to hide views entirely when they have no results, but apparently this works OK for block views, but not for page view...
Thank you
Comment | File | Size | Author |
---|---|---|---|
#4 | parent_gallery.jpg | 88.15 KB | marktheshark |
#4 | child_gallery.jpg | 50.79 KB | marktheshark |
Comments
Comment #1
scroogie CreditAttribution: scroogie commentedHow do you mean there is an empty view? Is it displayed for you? There should be nothing visible in such galleries.
Comment #2
marktheshark CreditAttribution: marktheshark commentedPerhaps it shows because the view has a skinr style applied, however, I would expect that nothing would be rendered in the first place (to apply styles to)... I will post screen-shots when I get back from work.
Comment #3
scroogie CreditAttribution: scroogie commentedI assumed that Views would return empty when the View does not return results, but apparently Iwas wrong. I could certainly build in a check for the number of results if the problem persists, at least for subgalleries.
Comment #4
marktheshark CreditAttribution: marktheshark commentedParent gallery has empty view node_gallery_gallery_image_views with display 'View all image thumbnails' from the Node Galleries module.
Child gallery has empty view node_gallery_hierarchy_views with display 'Galleries Cover Grid' from the Node Gallery Hierarchy module.
Attached screenshots (the empty views are the long rounded rectangles with no content).
Comment #5
scroogie CreditAttribution: scroogie commentedI just commited a check for the subgallery view, please test it if you can. I'm not sure how to deal with the empty image view. I could override the behaviour of Node Gallery here in Node Gallery Hierarchy, but I'm not sure if that would be the best solution.
Comment #6
marktheshark CreditAttribution: marktheshark commentedThe fix worked, thanks. Now galleries do not display an empty view if they do not have subgalleries. Any recommendation on what to change in Node Gallery to do the same? Would you say that an issue should be opened for that module?
Comment #7
scroogie CreditAttribution: scroogie commentedYes, probably.
Comment #8
marktheshark CreditAttribution: marktheshark commentedI opened one, though perhaps it will not be accepted as a valid request, since the real need to hide the empty image view arises when there is a non-empty sub-galleries view on the same page...
Perhaps this enhancement would be more at home in the current module.
Comment #9
scroogie CreditAttribution: scroogie commentedWell, it's possible to do here... I'm just not sure.
Comment #10
scroogie CreditAttribution: scroogie commentedAlready does hide empty views.