function IndexTidDepthModifier::preQuery
Same name in other branches
- 9 core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepthModifier.php \Drupal\taxonomy\Plugin\views\argument\IndexTidDepthModifier::preQuery()
- 8.9.x core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepthModifier.php \Drupal\taxonomy\Plugin\views\argument\IndexTidDepthModifier::preQuery()
- 11.x core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepthModifier.php \Drupal\taxonomy\Plugin\views\argument\IndexTidDepthModifier::preQuery()
Overrides HandlerBase::preQuery
File
-
core/
modules/ taxonomy/ src/ Plugin/ views/ argument/ IndexTidDepthModifier.php, line 26
Class
- IndexTidDepthModifier
- Argument handler for to modify depth for a previous term.
Namespace
Drupal\taxonomy\Plugin\views\argumentCode
public function preQuery() {
// We don't know our argument yet, but it's based upon our position:
$argument = $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;
}
$handler =& $this->view->argument[$key];
if (empty($handler->definition['accept depth modifier'])) {
continue;
}
// Finally!
$handler->options['depth'] = $argument;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.