Suggestion for correction:

function theme_attribute_formatter_default($element) {

+ if(!empty($element['#item']['value']))
+ {
$output = '

';
$output .= '
' . $element['#item']['attribute'] . '

';
$output .= '

' . $element['#item']['value'] . '

';
$output .= '

';
+ }

return $output;

Comments

hlopes’s picture

I forgot to mention the file to alter...

The file is attribute.module, the function starts at line 89.

mckeen_greg’s picture

Assigned: Unassigned » mckeen_greg
Category: bug » task

Hi HLopes,

Thank you for this! I will commit it to the next release as soon as possible.

finex’s picture

Why not use:

+ if(element['#item']['value'])

Instead of:

+ if(!empty($element['#item']['value']))

?

hlopes’s picture

Could be... I'm just used to use empty() to check for empty values...

These are the Return Values of empty in every case:

Returns FALSE if var has a non-empty and non-zero value.

The following things are considered to be empty:

* "" (an empty string)
* 0 (0 as an integer)
* "0" (0 as a string)
* NULL
* FALSE
* array() (an empty array)
* var $var; (a variable declared, but without a value in a class)

I think it has a broader coverage of what empty means...

finex’s picture

Yes... anyway, empty or not empty, the patch could be safely applied :-)