summaryrefslogtreecommitdiff
path: root/modules/field
diff options
context:
space:
mode:
Diffstat (limited to 'modules/field')
-rw-r--r--modules/field/field.info.inc27
-rw-r--r--modules/field/field.module8
2 files changed, 12 insertions, 23 deletions
diff --git a/modules/field/field.info.inc b/modules/field/field.info.inc
index c3b29573f..f435d99a6 100644
--- a/modules/field/field.info.inc
+++ b/modules/field/field.info.inc
@@ -24,8 +24,6 @@
* are affected.
*/
function field_info_cache_clear() {
- drupal_static_reset('field_view_mode_settings');
-
// @todo: Remove this when field_attach_*_bundle() bundle management
// functions are moved to the entity API.
entity_info_cache_clear();
@@ -275,7 +273,7 @@ function _field_info_prepare_field($field) {
* Prepares an instance definition for the current run-time context.
*
* Since the instance was last saved or updated, a number of things might have
- * changed: widgets or formatters disabled, new settings expected, new view
+ * changed: widgets or formatters disabled, new settings expected, new build
* modes added...
*
* @param $instance
@@ -303,21 +301,16 @@ function _field_info_prepare_instance($instance, $field) {
$instance['display'][$view_mode] = _field_info_prepare_instance_display($field, $display);
}
- // Fallback to 'hidden' for view modes configured to use custom display
- // settings, and for which the instance has no explicit settings.
+ // Fallback to 'hidden' for unspecified view modes.
$entity_info = entity_get_info($instance['entity_type']);
- $view_modes = array_merge(array('default'), array_keys($entity_info['view modes']));
- $view_mode_settings = field_view_mode_settings($instance['entity_type'], $instance['bundle']);
- foreach ($view_modes as $view_mode) {
- if ($view_mode == 'default' || !empty($view_mode_settings[$view_mode]['custom_settings'])) {
- if (!isset($instance['display'][$view_mode])) {
- $instance['display'][$view_mode] = array(
- 'type' => 'hidden',
- 'label' => 'above',
- 'settings' => array(),
- 'weight' => 0,
- );
- }
+ foreach ($entity_info['view modes'] as $view_mode => $info) {
+ if (!isset($instance['display'][$view_mode])) {
+ $instance['display'][$view_mode] = array(
+ 'type' => 'hidden',
+ 'label' => 'above',
+ 'settings' => array(),
+ 'weight' => 0,
+ );
}
}
diff --git a/modules/field/field.module b/modules/field/field.module
index d3545d911..823b0f24c 100644
--- a/modules/field/field.module
+++ b/modules/field/field.module
@@ -369,7 +369,7 @@ function _field_sort_items_value_helper($a, $b) {
* 'extra_field_2' => ...
* ),
* ),
- * );
+ * ),
* @endcode
*
* @param $entity_type
@@ -387,8 +387,8 @@ function field_bundle_settings($entity_type, $bundle, $settings = NULL) {
if (isset($settings)) {
$stored_settings[$entity_type][$bundle] = $settings;
-
variable_set('field_bundle_settings', $stored_settings);
+ drupal_static_reset('field_view_mode_settings');
field_info_cache_clear();
}
else {
@@ -397,10 +397,6 @@ function field_bundle_settings($entity_type, $bundle, $settings = NULL) {
'view_modes' => array(),
'extra_fields' => array(),
);
- $settings['extra_fields'] += array(
- 'form' => array(),
- 'display' => array(),
- );
return $settings;
}