You are here

function ds_revert_form in Display Suite 6

Same name and namespace in other branches
  1. 6.3 includes/ds.tools.inc \ds_revert_form()
  2. 6.2 includes/ds.tools.inc \ds_revert_form()

Revert form.

Parameters

string $module The name of the module.:

string $object_type The object type name.:

string $build_mode The build mode.:

1 string reference to 'ds_revert_form'
_ds_ui_menu in includes/ds.registry.inc
Return menu items and import default settings.

File

includes/ds.tools.inc, line 302
Tools for Display suite like export & import.

Code

function ds_revert_form($form_state, $module = '', $type = '', $build_mode = '') {
  $display_settings = variable_get($module . '_display_settings_' . $type, array());
  if (isset($display_settings[$build_mode]) && isset($display_settings[$build_mode]['status']) && $display_settings[$build_mode]['status'] == DS_SETTINGS_OVERRIDDEN) {
    $question = t('Are you sure you want to revert the display settings for %module, %type and %build_mode. This will bring back the default settings and any changes you have done will be lost.', array(
      '%module' => $module,
      '%type' => $type,
      '%build_mode' => $build_mode,
    ));
    $path = 'admin/build/ds/layout';
    $form['#module'] = $module;
    $form['#object_type'] = $type;
    $form['#build_mode'] = $build_mode;
    $form['#path'] = $path;
    return confirm_form($form, $question, $path);
  }
  else {
    drupal_set_message(t('Variables not found.'));
    drupal_goto('admin/build/ds');
  }
}