You are here

function panels_mini_import_form_submit in Panels 6.2

Same name and namespace in other branches
  1. 5.2 panels_mini/panels_mini.module \panels_mini_import_form_submit()

Handle the submit button on importing a mini panel.

File

panels_mini/panels_mini.admin.inc, line 326
Administrative items for the panels mini module.

Code

function panels_mini_import_form_submit($form, &$form_state) {
  ob_start();
  eval($form_state['values']['panel_mini']);
  ob_end_clean();
  if (isset($mini)) {
    drupal_set_title(t('Import mini panel "@s"', array(
      '@s' => $mini->title,
    )));

    // As $mini contains non-stdClass objects,
    // it needs to be serialized before being stored in the session variable.
    $_SESSION['pm_import'] = serialize($mini);
    $output = drupal_get_form('panels_mini_edit_form', $mini);
    print theme('page', $output);
    exit;
  }
  else {
    drupal_set_message(t('Unable to get a mini panel out of that.'));
  }
}