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.
The $field_empty template variable is set to false when the field is empty and a prefix or suffix is set in the field definition.
Comments
Comment #1
yched CreditAttribution: yched commentedTrue, the number formatter doesn't account for the case where the incoming value is array('value' => NULL).
Can be easily fixed, but raises a more general question : do we want those empty values to be present in $node to begin with ?
We currently get
$node->field_foo = array('value' = NULL);
We could chose to simply not load them (I think jpetso had that request, for instance) - could be either :
- no
$node->field_foo
entry if the field is empty.-
$node->field_foo = array();
if the field is empty.Comment #2
yched CreditAttribution: yched commentedAfter a bit of thinking, some formatters might want to display something special when a field is empty - so we need to load empty values anyway.
So I simply fixed the prefix / suffix bug for empty number fields.
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.