customformatters.com icon indicating copy to clipboard operation
customformatters.com copied to clipboard

Drupal API template

Open murraywoodman opened this issue 12 years ago • 0 comments

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

murraywoodman avatar Aug 06 '13 01:08 murraywoodman