You are here

function custom_formatters_engine_token_render in Custom Formatters 7.2

Render callback for Custom Formatters Token engine.

Parameters

object $formatter: The Custom formatter object.

string $obj_type: The Entity type.

object $object: The Entity object.

array $field: The Field settings.

array $instance: The Field instance.

string $langcode: The language code.

array $items: The Field items.

array $display: The display settings.

Return value

mixed|bool The output of the Custom formatter or FALSE.

1 string reference to 'custom_formatters_engine_token_render'
custom_formatters_custom_formatters_engine_info in includes/custom_formatters.inc
Implements hook_custom_formatters_engine().

File

engines/token.inc, line 69
Token engine for Custom Formatters modules.

Code

function custom_formatters_engine_token_render($formatter, $obj_type, $object, $field, $instance, $langcode, $items, $display) {
  $element = array();
  foreach ($items as $delta => $item) {
    $text = $formatter->code;
    $token_data = array(
      'obj_type' => $obj_type,
      $obj_type => $object,
      'item' => $item,
    );
    drupal_alter('custom_formatters_token_data', $token_data, $text, $field, $delta);
    $element[$delta] = array(
      '#markup' => token_replace($text, $token_data, array(
        'clear' => TRUE,
      )),
    );
  }
  return $element;
}