function styles_field_formatter_view in Styles 7.2
Same name and namespace in other branches
- 7 styles.module \styles_field_formatter_view()
Implements hook_field_formatter_view().
File
- ./
styles.module, line 40 - Bundles similar display formatters together.
Code
function styles_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
$element = array(
'#formatter' => $display['type'],
);
foreach ($items as $delta => $item) {
// @todo The variable name 'object' is misleading, but retained for
// backwards compatibility until a broader refactoring of the Styles
// module. For now, it's the $item array cast to an object. For File and
// Image fields, this is a fully loaded file object, because
// file_field_load() loads the referenced file and merges its properties
// into $item, but for other field types, it may simply be raw field data.
$element[$delta] = array(
'#markup' => theme('styles_field_formatter', array(
'element' => $element,
'object' => (object) $item,
'delta' => $delta,
'entity' => $entity,
)),
);
}
return $element;
}