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.
I'm finding it really difficult to display the duration of a video in the node.tpl.php file (or node preprocess). I can access it in views, and I can see it in the video_queue sql table, but I can't see it in the node or content arrays. There also doesn't seem to be a function in the video module that gets metadata easily. I'm fine to write my own query to fetch this, but I'm thinking there's got to be a better way.
Thanks.
Comments
Comment #1
Jorrit CreditAttribution: Jorrit commentedAt this moment there is no better way then writing your own query. I plan to add this info to the field information in one of the next releases.
Comment #2
burgs CreditAttribution: burgs commentedThanks Jorrit,
For anyone else that needs this in the node.tpl file, I've used the following code inside the node preprocess function in template.php in my theme. Any style/performance suggestions are always welcome.
Comment #3
burgs CreditAttribution: burgs commentedUpdating this to postponed.
Comment #4
Jorrit CreditAttribution: Jorrit commentedIf you expect to have many videos, I suggest to use an IN query to fetch all durations in one go. Otherwise, the code is fine.
Comment #5
brycefisherfleig CreditAttribution: brycefisherfleig commentedHas a patch for this been committed to a more recent version of this module? 7.x-2.6 is about 4 minor versions behind at this. I'd love to incorporate this feature, but I'm not sure if it's already in the module.