You are here

function field_ui_display_overview_multistep_js in Drupal 7

Ajax handler for multistep buttons on the 'Manage display' screen.

1 string reference to 'field_ui_display_overview_multistep_js'
field_ui_display_overview_form in modules/field_ui/field_ui.admin.inc
Form constructor for the field display settings for a given view mode.

File

modules/field_ui/field_ui.admin.inc, line 1280
Administrative interface for custom field type creation.

Code

function field_ui_display_overview_multistep_js($form, &$form_state) {
  $trigger = $form_state['triggering_element'];
  $op = $trigger['#op'];

  // Pick the elements that need to receive the ajax-new-content effect.
  switch ($op) {
    case 'edit':
      $updated_rows = array(
        $trigger['#field_name'],
      );
      $updated_columns = array(
        'format',
      );
      break;
    case 'update':
    case 'cancel':
      $updated_rows = array(
        $trigger['#field_name'],
      );
      $updated_columns = array(
        'format',
        'settings_summary',
        'settings_edit',
      );
      break;
    case 'refresh_table':
      $updated_rows = array_values(explode(' ', $form_state['values']['refresh_rows']));
      $updated_columns = array(
        'settings_summary',
        'settings_edit',
      );
      break;
  }
  foreach ($updated_rows as $name) {
    foreach ($updated_columns as $key) {
      $element =& $form['fields'][$name][$key];
      $element['#prefix'] = '<div class="ajax-new-content">' . (isset($element['#prefix']) ? $element['#prefix'] : '');
      $element['#suffix'] = (isset($element['#suffix']) ? $element['#suffix'] : '') . '</div>';
    }
  }

  // Return the whole table.
  return $form['fields'];
}