You are here

class nat_handler_argument_term_node_tid_depth_modifier in Node Auto Term [NAT] 6

Same name and namespace in other branches
  1. 6.2 includes/nat_handler_argument_term_node_tid_depth_modifier.inc \nat_handler_argument_term_node_tid_depth_modifier
  2. 7.2 includes/nat_handler_argument_term_node_tid_depth_modifier.inc \nat_handler_argument_term_node_tid_depth_modifier
  3. 7 includes/nat_handler_argument_term_node_tid_depth_modifier.inc \nat_handler_argument_term_node_tid_depth_modifier

Argument handler to modify depth for a previous NAT term.

This handler is actually part of the node table and has some restrictions because it uses a subquery to find nodes.

Hierarchy

Expanded class hierarchy of nat_handler_argument_term_node_tid_depth_modifier

1 string reference to 'nat_handler_argument_term_node_tid_depth_modifier'
nat_views_data_alter in includes/nat.views.inc
Implementation of hook_views_data_alter().

File

includes/nat_handler_argument_term_node_tid_depth_modifier.inc, line 14
NAT (Node Auto Term) nid views argument with depth modifier.

View source
class nat_handler_argument_term_node_tid_depth_modifier extends views_handler_argument {
  function options_form(&$form, &$form_state) {
  }
  function query() {
  }
  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;
    }
  }

}

Members