function views_handler_argument_term_node_tid_depth_modifier::pre_query

cis7 views_handler_argument_term_node_tid_depth_modifier.inc views_handler_argument_term_node_tid_depth_modifier::pre_query()
cle7 views_handler_argument_term_node_tid_depth_modifier.inc views_handler_argument_term_node_tid_depth_modifier::pre_query()
elmsmedia7 views_handler_argument_term_node_tid_depth_modifier.inc views_handler_argument_term_node_tid_depth_modifier::pre_query()
icor7 views_handler_argument_term_node_tid_depth_modifier.inc views_handler_argument_term_node_tid_depth_modifier::pre_query()
meedjum_blog7 views_handler_argument_term_node_tid_depth_modifier.inc views_handler_argument_term_node_tid_depth_modifier::pre_query()
mooc7 views_handler_argument_term_node_tid_depth_modifier.inc views_handler_argument_term_node_tid_depth_modifier::pre_query()

Run before the view is built.

This gives all the handlers some time to set up before any handler has been fully run.

Overrides views_handler::pre_query

File

sites/all/modules/ulmus/views/modules/taxonomy/views_handler_argument_term_node_tid_depth_modifier.inc, line 19
Definition of views_handler_argument_term_node_tid_depth_modif.

Class

views_handler_argument_term_node_tid_depth_modifier
Argument handler for to modify depth for a previous term.

Code

function pre_query() {
  // We don't know our argument yet, but it's based upon our position:
  $argument = isset($this->view->args[$this->position]) ? $this->view->args[$this->position] : NULL;
  if (!is_numeric($argument)) {
    return;
  }

  if ($argument > 10) {
    $argument = 10;
  }

  if ($argument < -10) {
    $argument = -10;
  }

  // figure out which argument preceded us.
  $keys = array_reverse(array_keys($this->view->argument));
  $skip = TRUE;
  foreach ($keys as $key) {
    if ($key == $this->options['id']) {
      $skip = FALSE;
      continue;
    }

    if ($skip) {
      continue;
    }

    if (empty($this->view->argument[$key])) {
      continue;
    }

    if (isset($handler)) {
      unset($handler);
    }

    $handler = &$this->view->argument[$key];
    if (empty($handler->definition['accept depth modifier'])) {
      continue;
    }

    // Finally!
    $handler->options['depth'] = $argument;
  }
}