You are here

public function ctools_export_ui::add_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::add_page()

File

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

Class

ctools_export_ui
Base class for export UI.

Code

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

  // 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($this->plugin['use wizard']) && !empty($step)) {
    $item = $this
      ->edit_cache_get(NULL, 'add');
  }
  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' => 'add',
    'rerender' => TRUE,
    'no_redirect' => TRUE,
    'step' => $step,
    // Store these in case additional args are needed.
    'function args' => $args,
  );
  $output = $this
    ->edit_execute_form($form_state);
  if (!empty($form_state['executed']) && empty($form_state['rebuild'])) {
    $this
      ->redirect($form_state['op'], $form_state['item']);
  }
  return $output;
}