You are here

function ds_field_row_form_format_construct in Display Suite 8.2

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

Helper function for building the formatter settings.

1 call to ds_field_row_form_format_construct()
_ds_field_ui_fields in includes/field_ui.inc
Add the fields to the Field UI form.

File

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

Code

function ds_field_row_form_format_construct(&$table, $key, $settings_form, FormStateInterface $form_state) {
  $build_info = $form_state
    ->getBuildInfo();
  $base_button = array(
    '#submit' => array(
      array(
        $build_info['callback_object'],
        'multistepSubmit',
      ),
    ),
    '#validate' => array(
      'ds_field_ui_fields_validate',
    ),
    '#ajax' => array(
      'callback' => array(
        $build_info['callback_object'],
        'multistepAjax',
      ),
      'wrapper' => 'field-display-overview-wrapper',
      'effect' => 'fade',
    ),
    '#field_name' => $key,
  );
  $table[$key]['plugin']['settings_edit'] = array(
    '#type' => 'container',
    '#attributes' => array(
      'class' => array(
        'field-plugin-settings-edit-form',
      ),
    ),
    '#parents' => array(
      'fields',
      $key,
      'settings_edit_form',
    ),
    '#weight' => -5,
    // Create a settings form where hooks can pick in.
    'settings' => $settings_form,
    'actions' => array(
      '#type' => 'actions',
      'save_settings' => $base_button + array(
        '#type' => 'submit',
        '#name' => $key . '_plugin_settings_update',
        '#value' => t('Update'),
        '#op' => 'update',
      ),
      'cancel_settings' => $base_button + array(
        '#type' => 'submit',
        '#name' => $key . '_plugin_settings_cancel',
        '#value' => t('Cancel'),
        '#op' => 'cancel',
        // Do not check errors for the 'Cancel' button.
        '#limit_validation_errors' => array(),
      ),
    ),
  );
  $table[$key]['#attributes']['class'][] = 'field-plugin-settings-editing';
  $table[$key]['plugin']['type']['#attributes']['class'] = array(
    'visually-hidden',
  );
}