| Versionen | |
|---|---|
| drupal7 | _field_get_formatter($display, $field) |
Return valid formatter type and settings.
Backs up to default formatter and settings if the intended formatter is no longer available. This might happen when the formatter has been renamed in the module, or if the module has been disabled since then.
modules/
<?php
function _field_get_formatter($display, $field) {
if ($display['type'] != 'hidden') {
$formatter_type = field_info_formatter_types($display['type']);
if (empty($formatter_type)) {
$field_type = field_info_field_types($field['type']);
$display['type'] = $field_type['default_formatter'];
$formatter_type = field_info_formatter_types($display['type']);
}
$function = $formatter_type['module'] . '_field_formatter_settings';
if (drupal_function_exists($function)) {
$display['settings'] += $function($display['type']);
}
}
return $display;
}
?>
Kommentare
Kommentar hinzufügen