You are here

function current_search_export_ui::add_page in Facet API 7.2

Same name and namespace in other branches
  1. 6.3 contrib/current_search/plugins/export_ui/current_search_export_ui.class.php \current_search_export_ui::add_page()
  2. 7 contrib/current_search/plugins/export_ui/current_search_export_ui.class.php \current_search_export_ui::add_page()

Overrides ctools_export_ui::add_page().

Allows passing of options to drupal_goto() as opposed to just a path.

Overrides ctools_export_ui::add_page

See also

http://drupal.org/node/1373048

File

contrib/current_search/plugins/export_ui/current_search_export_ui.class.php, line 114
Export UI display customizations.

Class

current_search_export_ui
CTools export UI extending class. Slightly customized for Context.

Code

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

  // 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' => func_get_args(),
  );
  $output = $this
    ->edit_execute_form($form_state);
  if (!empty($form_state['executed'])) {

    // @see @see http://drupal.org/node/1373048
    $export_key = $this->plugin['export']['key'];
    $args = (array) $this->plugin['redirect']['add'];
    $args[0] = str_replace('%ctools_export_ui', $form_state['item']->{$export_key}, $args[0]);
    call_user_func_array('drupal_goto', $args);
  }
  return $output;
}