You are here

public function ctools_export_ui::import_page in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 plugins/export_ui/ctools_export_ui.class.php \ctools_export_ui::import_page()

Page callback to import information for an exportable item.

File

plugins/export_ui/ctools_export_ui.class.php, line 1242

Class

ctools_export_ui
Base class for export UI.

Code

public function import_page($js, $input, $step = NULL) {
  $args = func_get_args();
  drupal_set_title($this
    ->get_page_title('import'), PASS_THROUGH);

  // Import is basically a multi step wizard form, so let's go ahead and
  // use CTools' wizard.inc for it.
  // If a step not set, they are trying to create a new item. If a step
  // is set, they're in the process of creating an item.
  if (!empty($step)) {
    $item = $this
      ->edit_cache_get(NULL, 'import');
  }
  if (empty($item)) {
    $item = ctools_export_crud_new($this->plugin['schema']);
  }
  $form_state = array(
    'plugin' => $this->plugin,
    'object' => &$this,
    'ajax' => $js,
    'item' => $item,
    'op' => 'add',
    'form type' => 'import',
    'rerender' => TRUE,
    'no_redirect' => TRUE,
    'step' => $step,
    // Store these in case additional args are needed.
    'function args' => $args,
  );

  // import always uses the wizard.
  $output = $this
    ->edit_execute_form_wizard($form_state);
  if (!empty($form_state['executed'])) {
    $this
      ->redirect($form_state['op'], $form_state['item']);
  }
  return $output;
}