Using Video in internal collections - possible to hide blank entries?
Lets say I have a list of items, each displayed on a dynamic page. In this collection, all the entries has unique ID, title, text, image, and some other information.
The issue:
Some entries may have a youtube-video, others not.
When using the video-widget, connected to this collection, the placeholder for the video is displayed even if the field for video-URL in the collection is empty.
Is there a way to "if" this out? Meaning that the video player only displays if the entry in the collection actually has a video-url?
Since Video is a collection-field-type and supports the Video widget, I find it quite surprising that this is not built-in functionality.
I hope someone can help me with a solution - or at least a work-around?
Answers
-
I made a custom widget to solve this. Still interested in an answer, however. :)
1 -
@jenmagjen You can not hide certain parts of a Dynamic Page if a field is EMPTY. If that is the goal you are looking for. Anything on a Static "Dynamic Page" will show up. If the field is empty, then the placeholder image/text will be displayed. You could inject some code into the collection to either HIDE the whole row (if a field is empty) I believe, but if you do that, that entire row will be hidden, not just the video field.
0 -
Very cool! Would love to see it (if you want to share it with us!) :)
0 -
Yes, I can make a bit more robust, and then share it. It's simple - uses the Plain Text input in a collection. Extracts the youtube (and later also Vimeo) ID - and inserts into an iframe with a responsive container.
If the given URL in the collection is less than 8 chars (or whatever I put), it simply does not display anything.
Just some really simple JS, combined with handlebars in the html-part.
I'm considering making similar for Plain Text, Rich Text, perhaps images and links as well. In that way, dynamic pages can be built a bit more dynamic.
1 -
Looking forward to it!
0 -
This is exactly the thing I need, hoping @Sheyla will share! Thank you, Sarah
0