You are here

function _ds_field_valid in Display Suite 7.2

Same name and namespace in other branches
  1. 7 ds.field_ui.inc \_ds_field_valid()

Utility function to check if we need to save anything for this field.

2 calls to _ds_field_valid()
ds_extras_ds_field_settings_alter in modules/ds_extras/ds_extras.module
Implements hook_ds_field_settings_alter().
ds_field_ui_layouts_save in includes/ds.field_ui.inc
Save the layout settings from the 'Manage display' screen.

File

includes/ds.field_ui.inc, line 2571
Field UI functions for Display Suite.

Code

function _ds_field_valid($key, $field, &$form_state, $view_mode = 'default') {
  $continue = FALSE;

  // Ignore the Field group module and the region to block plugin.
  if ($key == '_add_new_group' || $key == '_add_new_field' || $key == '_add_new_block_region') {
    $continue = TRUE;
  }

  // If the field is in hidden region, do not save. Check if the
  // field has a type key which means it's from Field API and
  // we need to reset that type to 'hidden' so it doesn't get
  // fired by Field API in the frontend.
  if (isset($field['region']) && $field['region'] == 'hidden') {
    if (isset($field['type']) && $view_mode != 'form') {
      $form_state['values']['fields'][$key]['type'] = 'hidden';
    }

    // In case of a form, fields will be set with #access to FALSE.
    if ($view_mode != 'form') {
      $continue = TRUE;
    }
  }
  return $continue;
}