MenuTreeParameters::addCondition

public MenuTreeParameters::addCondition($definition_field, $value, $operator = NULL)

Adds a custom query condition.

Parameters

string $definition_field: Only conditions that are testing menu link definition fields are allowed.

mixed $value: The value to test the link definition field against. In most cases, this is a scalar. For more complex options, it is an array. The meaning of each element in the array is dependent on the $operator.

string|null $operator: (optional) The comparison operator, such as =, <, or >=. It also accepts more complex options such as IN, LIKE, or BETWEEN. If NULL, defaults to the = operator.

Return value

$this

File

core/lib/Drupal/Core/Menu/MenuTreeParameters.php, line 168

Class

MenuTreeParameters
Provides a value object to model menu tree parameters.

Namespace

Drupal\Core\Menu

Code

public function addCondition($definition_field, $value, $operator = NULL) {
  if (!isset($operator)) {
    $this->conditions[$definition_field] = $value;
  }
  else {
    $this->conditions[$definition_field] = array($value, $operator);
  }
  return $this;
}
doc_Drupal
2016-10-29 09:27:30
Comments
Leave a Comment

Please login to continue.