function field_ui_formatter_options in Drupal 7
Returns an array of formatter options for a field type.
If no field type is provided, returns a nested array of all formatters, keyed by field type.
1 call to field_ui_formatter_options()
- field_ui_display_overview_form in modules/
field_ui/ field_ui.admin.inc - Form constructor for the field display settings for a given view mode.
File
- modules/
field_ui/ field_ui.admin.inc, line 1502 - Administrative interface for custom field type creation.
Code
function field_ui_formatter_options($field_type = NULL) {
$options =& drupal_static(__FUNCTION__);
if (!isset($options)) {
$field_types = field_info_field_types();
$options = array();
foreach (field_info_formatter_types() as $name => $formatter) {
foreach ($formatter['field types'] as $formatter_field_type) {
// Check that the field type exists.
if (isset($field_types[$formatter_field_type])) {
$options[$formatter_field_type][$name] = $formatter['label'];
}
}
}
}
if ($field_type) {
return !empty($options[$field_type]) ? $options[$field_type] : array();
}
return $options;
}