You are here

function finder_wizard_establish_page in Finder 7.2

Determine which page we are on, both numerically and by identity.

3 calls to finder_wizard_establish_page()
finder_wizard_finder_form in modules/finder_wizard/finder_wizard.module
Implements hook_finder_form().
finder_wizard_finder_results in modules/finder_wizard/finder_wizard.module
Implements hook_finder_results().
finder_wizard_skip_element in modules/finder_wizard/plugins/element_handler/page.inc
Skip element callback.

File

modules/finder_wizard/finder_wizard.module, line 239
The Finder page module.

Code

function finder_wizard_establish_page($finder) {
  if (!empty($_GET[$finder
    ->setting('finder_wizard_url_page')])) {

    // This was already worked out upon submission and the page_id is in the url.
    $finder->finder_wizard_page_id = $_GET[$finder
      ->setting('finder_wizard_url_page')];
    $finder_wizard_index = array_keys($finder->finder_wizard);
    $finder->finder_wizard_page_num = array_search($finder->finder_wizard_page_id, $finder_wizard_index);
  }
  else {

    // Not in the url, work it out.
    $form_state = $finder->form_state;
    $direction = 1;
    if (!empty($form_state['clicked_button']) && $form_state['clicked_button']['#name'] == 'back') {
      $direction = -1;
    }
    $finder->finder_wizard_page_num = isset($form_state['input']['finder_wizard_page_num']) ? $form_state['input']['finder_wizard_page_num'] + $direction : 0;
    $finder_wizard_index = array_keys($finder->finder_wizard);
    $finder->finder_wizard_page_id = NULL;
    if (isset($finder_wizard_index[$finder->finder_wizard_page_num])) {
      $finder->finder_wizard_page_id = $finder_wizard_index[$finder->finder_wizard_page_num];
    }
  }
}