Closed (fixed)
Project:
FileField
Version:
6.x-3.2
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
30 Dec 2009 at 03:34 UTC
Updated:
15 Aug 2010 at 00:41 UTC
I created a view with different fields, one of them being the duration of an emfield.
The view allow to hide a field if it is empty. If you display the field in seconds ( ss ), it works but if you decide to show the field as mm:ss, the field still show up with 00:00 as data.
Where does this bug goes ?
Comments
Comment #1
CinemaSaville commentedI've got the same issue.
Comment #2
discipolo commentedi had the same.
added a theme function in template.php to make filefield_meta display '0' instead of '0:00' so views recognizes it and hides it.
taken from (api.lullabot.com/theme_filefield_meta_duration)
/* set duration to 0 if empty*/
function MYTheme_filefield_meta_duration($duration) {
$seconds = round((($duration / 60) - floor($duration / 60)) * 60);
$minutes = floor($duration / 60);
if ($seconds >= 60) {
$seconds -= 60;
$minutes++;
}
if($seconds == 0 && $minutes == 0) {return 0 ;}else{
return intval($minutes) . ':' . str_pad($seconds, 2, 0, STR_PAD_LEFT);}
}
Comment #3
quicksketchHm, interesting, that seems like something that should be taken into account in the Views handler for duration. Actually it may be taken into account already in the 3.3 version, which fixed a bunch of problems in FileField Meta.
Comment #4
discipolo commentedhm... doesnt seem fixed in 3.3 version as far as i can tell but the error is different. (duration is hidden and handled as empty even if it has content)
Comment #5
quicksketchI can't reproduce this problem in 3.3 and higher. We currently have this code in place:
So this means that a value of "0" will not be show if you have the "Count the number 0 as empty" option checked. If the value is NULL or an empty string, the field will be hidden as long as "Hide if empty" is checked.
Please open a new issue if there is a different problem regarding duration display, but my testing indicates this problem is already corrected.