Skip to content

Drupal API template #7

@murraywoodman

Description

@murraywoodman

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions