Hey guys,

how can I hide empty galleries from the galleries overview?

Thanks

Yannick

Comments

auris’s picture

Similar needs here. I want a view to display galleries without images.

eL’s picture

Category: feature » bug
Priority: Normal » Critical

OMG, empty galleries should not definitely be displayed in overview and on any other public place!

Critical!

May be some reverse node reference to ask, if gallery has any image referenced to this...?

eL’s picture

Everybody wants to show ugly empty galleries on frontpage???

skizzo’s picture

Title: Do not display empty galleries in overview » Do not display empty galleries in frontpage
Category: bug » support
Priority: Critical » Normal

Create the Gallery as "not published" (Content type's Workflow Settings). Add a triggered rule (Rules module): ON event After saving new content, IF Created content is GALLERY IMAGE, Load a referenced node (Field: field_gallery), Publish Referenced Content (Content: Referenced Content). You could get fancy: add image counter to Gallery (module nodereference_count), then using rules and rule sets you can publish/unpublish the Gallery based on its image count being >= N, so that gallery gets unpublished if all images are removed, if there are too few images, if there are too many images, etc...

eL’s picture

skizzo: nice, thanks!

eL’s picture

we should be more specific and make it more usable:

- checking on every image upload, if it belongs to gallery, that is not epmty, is quiet big useless performance impact. Isn't it? Same for re-publishing again and again for new images in the same gallery...
- checking number of images in gallery looks powerfull. We can only do an numeric comparsion, if nodereference-count is bigger than 0 and than set gallery to publish. But this apply only on gallery, that is updated. Not if we upload new (first) image to that gallery (gallery is only referenced from image).

Am I right?

skizzo’s picture

- how many images per hour are you adding? impact on server load might be negligible
- I am not sure I understand your point: you cannot create image unless you have created a gallery first. Before adding image the counter (in gallery node) is zero.

eL’s picture

ok, may be, it is not so big impact for server...

anyway - your first tip 100 % works. Second, with nodereference count, for me not. But probably I´m only not able to set it right in Rules.

eL’s picture

hm, worked fine, unless user deleted all images from gallery... than, this gallery is published, but epmty