You are here

function ds_import_submit in Display Suite 6.3

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

Import submit function.

File

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

Code

function ds_import_submit($form_id, &$form_state) {
  $error = FALSE;
  ob_start();
  eval($form_state['values']['import']);
  ob_end_clean();

  // Validate the data. $data variable comes from the eval() function above.
  if (!is_array($data)) {
    $error = TRUE;
    drupal_set_message(t('Data string is not an array.'), 'error');
  }

  // All ok, let's import.
  if ($error == FALSE) {
    ds_import_data($data, TRUE, TRUE);
  }
}