protected function ViewsTest::collectConditions in Search API Autocomplete 8
Collects conditions from an array of conditions and condition groups.
Any information about condition nesting, group operators, etc. is lost. Only makes sense for tests.
Parameters
\Drupal\search_api\Query\ConditionInterface[]|\Drupal\search_api\Query\ConditionGroupInterface[] $conditions: An array of conditions and condition groups.
Return value
\Drupal\search_api\Query\ConditionInterface[] All conditions contained in the given array of conditions and condition groups.
1 call to ViewsTest::collectConditions()
- ViewsTest::testSearchPlugin in tests/
src/ Kernel/ ViewsTest.php - Tests that valid search plugin definitions are created for search views.
File
- tests/
src/ Kernel/ ViewsTest.php, line 145
Class
- ViewsTest
- Tests Views integration of the Autocomplete module.
Namespace
Drupal\Tests\search_api_autocomplete\KernelCode
protected function collectConditions(array $conditions) {
$ret = [];
foreach ($conditions as $condition) {
if ($condition instanceof ConditionInterface) {
$ret[] = $condition;
}
else {
$new = $this
->collectConditions($condition
->getConditions());
$ret = array_merge($ret, $new);
}
}
return $ret;
}