Use case: A nodes change date may be printed in date format 'medium'.
Problem: return value of WdNodeWrapper->getChangedTime('medium')
is empty.
Workaround: set an empty string as argument $custom_format
to the method call: WdNodeWrapper->getChangedTime('medium', '')
Analysis:
WdNodeWrapper->getChangedTime()
and WdEntityWrapper->getDate()
have their third argument ($custom_format
) set to NULL
by default.
Unfortunately Drupals function form_data
- which is used by WdEntityWrapper->getDate()
- checks (when the date type is 'medium') whether the $custom_format
is an _empty string_ (not NULL
!):
common.inc, at line 2030 (Drupal 7.37):
[...]
// Fall back to 'medium'.
if ($format === '') {
$format = variable_get('date_format_medium', 'D, m/d/Y - H:i');
}
[...]
Possible fix: Set the default value of the arguments $custom_format
to ''
instead of NULL
.
Comments
Comment #3
zengenuity CreditAttribution: zengenuity at Zengenuity commentedYou're right. Thanks for digging into it to find out the cause.
I've fixed this in 7.x-1.x-dev.