You are here

function ds_extras_vd_field_ui in Display Suite 7

Same name and namespace in other branches
  1. 7.2 modules/ds_extras/includes/ds_extras.vd.inc \ds_extras_vd_field_ui()

Return Field UI display screen for a view and bundle.

Parameters

$bundle: The name of the bundle

1 call to ds_extras_vd_field_ui()
ds_extras_vd_manage in modules/ds_extras/ds_extras.vd.inc
Edit the display or remove a views display.

File

modules/ds_extras/ds_extras.vd.inc, line 157
Views displays functions.

Code

function ds_extras_vd_field_ui($bundle) {

  // Disable editor switch.
  global $conf;
  $conf['ds_extras_panel_view_modes'] = FALSE;
  $conf['ds_extras_switch_editor'] = FALSE;

  // Use drupal_build_form instead of drupal_get_form.
  $form_state = array();
  $arguments = array(
    'ds_views',
    $bundle,
    'default',
  );
  $form_state['build_info']['args'] = $arguments;
  $form_state['no_panels'] = TRUE;
  $form_state['no_view_mode_suggestions'] = TRUE;
  form_load_include($form_state, 'inc', 'field_ui', 'field_ui.admin');
  form_load_include($form_state, 'inc', 'ds_extras', 'ds_extras.vd');

  // Deny access to field_group if it exists.
  if (module_exists('field_group')) {
    $form_state['no_field_group'] = TRUE;
  }

  // Build form.
  $build = drupal_build_form('field_ui_display_overview_form', $form_state);

  // Deny access to view modes.
  $build['additional_settings']['modes']['#access'] = FALSE;

  // Deny access to disabling blocks and regions.
  $build['additional_settings']['ds_layouts']['hide_sidebars']['#access'] = FALSE;

  // Deny access to fields table if there's no layout.
  if (!ds_get_layout('ds_views', $bundle, 'default')) {
    $build['fields']['#access'] = FALSE;
  }

  // Add additional validate function so we can remove notices.
  if (module_exists('field_group')) {
    array_unshift($build['#validate'], 'ds_vd_field_ui_fix_notices');
  }
  return $build;
}