You are here

function panelizer_hide_fields_on_panelized_view_mode in Panelizer 7.3

Hide all fields on a view mode.

@todo, connect this function to a form and/or ajax callback.

File

./panelizer.install, line 338
Install, update and uninstall functions for the panelizer module.

Code

function panelizer_hide_fields_on_panelized_view_mode($entity_type, $bundle, $view_mode) {
  $bundle = field_extract_bundle($entity_type, $bundle);
  $instances = field_info_instances($entity_type, $bundle);
  foreach ($instances as $instance) {
    if (!empty($instance['display'][$view_mode]['type'])) {
      $instance['display'][$view_mode]['type'] = 'hidden';
      field_update_instance($instance);
    }
  }
}