customformatters.com
customformatters.com copied to clipboard
Drupal API template
I've just had a look at the code used in the "Drupal API" version of a formatter, in particular, the MY_MODULE_field_formatter_view function. You have the following code to assign the element:
if (function_exists($function = "{$display['module']}_field_formatter_{$display['type']}")) {
$element[0] = array(
'#markup' => $function($variables),
);
}
I had to make the following change to get it to work:
if (function_exists($function = "{$display['module']}_field_formatter_{$display['type']}")) {
$element = $function($variables);
}
cheers
Murray