How can I test if the youtube video has a description? In other words, since the youtube_video id is an array, how can I test for the description key only?
Using template conditionals with arrays (YouTube field type)
- Tim Kinali
- Thread is marked as Resolved.
-
-
drewm
Approved the thread. -
The <perch:if> tag doesn't work with the output attribute. Your best bet would be to use the each option in perch_content_custom and add a key if the description exists
Then in the template you can use
You'll likely need to tweak the above so it works correctly, haven't used the youtube field type before.
-
That's smart. However the videos are in added to the region with blocks. What's the best way to get to them within the each function?
-
You'll have to loop through each block individually as well. Can't remember the exact syntax, but you can always do a var_dump() to get the exact structure of the array returned
-
Yes that should work. Thanks a lot!
-
How can I test if the youtube video has a description? In other words, since the youtube_video id is an array, how can I test for the description key only?
thanks my issue has been fixed.