You are here

function ds_field_ui_fields_layouts in Display Suite 7

Same name and namespace in other branches
  1. 8.4 includes/field_ui.inc \ds_field_ui_fields_layouts()
  2. 8.2 includes/field_ui.inc \ds_field_ui_fields_layouts()
  3. 8.3 includes/field_ui.inc \ds_field_ui_fields_layouts()
  4. 7.2 includes/ds.field_ui.inc \ds_field_ui_fields_layouts()

Adds the Display Suite fields and layouts to the form.

2 calls to ds_field_ui_fields_layouts()
ds_forms_form_field_ui_field_overview_form_alter in modules/ds_forms/ds_forms.module
Implements hook_form_FORM_ID_alter().
ds_form_field_ui_display_overview_form_alter in ./ds.module
Implements hook_form_FORM_ID_alter().

File

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

Code

function ds_field_ui_fields_layouts(&$form, &$form_state) {
  global $base_root, $base_path;

  // Get the entity_type, bundle and view mode.
  $entity_type = $form['#entity_type'];
  $bundle = $form['#bundle'];
  $view_mode = $form['#view_mode'];
  $form['#export_id'] = $entity_type . '|' . $bundle . '|' . $view_mode;

  // Create vertical tabs.
  ds_field_ui_create_vertical_tabs($form);

  // Add layout fieldset.
  _ds_field_ui_table_layouts($entity_type, $bundle, $view_mode, $form, $form_state);

  // Add the fields on the table.
  if ($view_mode != 'form') {
    _ds_field_ui_fields($entity_type, $bundle, $view_mode, $form, $form_state);
  }

  // Add buttons to add fields in overlay.
  if (isset($form['#ds_layout']) && user_access('admin_fields') && $view_mode != 'form') {
    _ds_field_ui_custom_fields($entity_type, $bundle, $view_mode, $form, $form_state);
  }

  // Special validate function for field group.
  if (isset($form_state['no_field_group'])) {
    array_unshift($form['#validate'], '_ds_field_group_field_ui_fix_notices');
  }

  // Attach js.
  $form['#attached']['js'][] = drupal_get_path('module', 'ds') . '/js/ds.js';

  // Attach css.
  $form['#attached']['css'][] = drupal_get_path('module', 'ds') . '/css/ds.admin.css';

  // Add process function to add the regions.
  $form['#process'][] = 'ds_field_ui_regions';

  // Add a destination so we can get back if layout has been changed.
  $form['ds_source'] = array(
    '#type' => 'hidden',
    '#value' => $base_root . $base_path,
  );
  $form['ds_destination'] = array(
    '#type' => 'hidden',
    '#value' => drupal_get_destination(),
  );
  $form['ds_entity_type'] = array(
    '#type' => 'hidden',
    '#value' => $entity_type,
  );
  $form['ds_bundle'] = array(
    '#type' => 'hidden',
    '#value' => $bundle,
  );
  $form['ds_view_mode'] = array(
    '#type' => 'hidden',
    '#value' => $view_mode,
  );
}