- $options = &drupal_static(__FUNCTION__);
instead of $options = &drupal_static(__FUNCTION__, array());
in field_ui_field_type_options(), field_ui_widget_type_options(), field_ui_formatter_options()
- New code for field_ui_widget_type_options(), field_ui_formatter_options()
$widget_type) {
foreach ($widget_type['field types'] as $widget_field_type) {
// Check that the field type exists.
if (isset($field_types[$widget_field_type])) {
$options[$widget_field_type][$name] = $widget_type['label'];
}
}
}
}
if ($field_type) {
return !empty($options[$field_type]) ? $options[$field_type] : array();
}
elseif ($by_label) {
$field_types = field_info_field_types();
$options_by_label = array();
foreach ($options as $field_type => $widgets) {
$options_by_label[$field_types[$field_type]['label']] = $widgets;
}
return $options_by_label;
}
else {
return $options;
}
}
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[$widget_field_type])) {
$options[$formatter_field_type][$name] = $formatter['label'];
}
}
}
}
if ($field_type) {
return !empty($options[$field_type]) ? $options[$field_type] : array();
}
else {
return $options;
}
}
?>