function field_count_formatter_field_formatter_view in Field Count Formatter 7
Implements hook_field_formatter_view().
File
- ./
field_count_formatter.module, line 29 - Simple module to provide a formatter for all field types to show the number of items entered into the field. This is most useful for multiple value fields.
Code
function field_count_formatter_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
$element = array();
// ... In case we add another formatter.
if ($display['type'] == 'count') {
$element[0]['#markup'] = count($items);
}
return $element;
}