/**
* Format a field item for display.
*
* @param $field
* Either a field array or the name of the field.
* @param $item
* The field item to be formatted (such as $node->field_foo[0]).
* @param $formatter
* The name of the formatter to use.
* @param $node
* Optionally, the containing node object for context purposes.
*
* @return
* A string containing the contents of the field item sanitized for display.
* It will have been passed through the necessary check_plain() or check_markup()
* functions as necessary.
*/functioncontent_format($field, $item, $formatter = 'default', $node = NULL) {
if (!is_array($field)) {
$field = content_fields($field);
}
$field_types = _content_field_types();
$formatters = $field_types[$field['type']]['formatters'];
if (!isset($formatter, $formatters)) {
$formatter = 'default';
}
return module_invoke($formatters[$formatter]['module'], 'field_formatter', $field, $item, $formatter, $node);
}