class ViewsSearchQuery
Same name in this branch
- 10 core/tests/fixtures/database_drivers/module/core_fake/src/Driver/Database/CoreFakeWithAllCustomClasses/ViewsSearchQuery.php \Drupal\core_fake\Driver\Database\CoreFakeWithAllCustomClasses\ViewsSearchQuery
Same name in other branches
- 9 core/modules/search/src/ViewsSearchQuery.php \Drupal\search\ViewsSearchQuery
- 9 core/tests/fixtures/database_drivers/module/corefake/src/Driver/Database/corefakeWithAllCustomClasses/ViewsSearchQuery.php \Drupal\corefake\Driver\Database\corefakeWithAllCustomClasses\ViewsSearchQuery
- 8.9.x core/modules/search/src/ViewsSearchQuery.php \Drupal\search\ViewsSearchQuery
- 11.x core/modules/search/src/ViewsSearchQuery.php \Drupal\search\ViewsSearchQuery
- 11.x core/tests/fixtures/database_drivers/module/core_fake/src/Driver/Database/CoreFakeWithAllCustomClasses/ViewsSearchQuery.php \Drupal\core_fake\Driver\Database\CoreFakeWithAllCustomClasses\ViewsSearchQuery
Extends the core SearchQuery to be able to gets its protected values.
Hierarchy
- class \Drupal\Core\Database\Query\SelectExtender implements \Drupal\Core\Database\Query\SelectInterface
- class \Drupal\search\SearchQuery extends \Drupal\Core\Database\Query\SelectExtender
- class \Drupal\search\ViewsSearchQuery extends \Drupal\search\SearchQuery
- class \Drupal\search\SearchQuery extends \Drupal\Core\Database\Query\SelectExtender
Expanded class hierarchy of ViewsSearchQuery
3 files declare their use of ViewsSearchQuery
- Search.php in core/
modules/ search/ src/ Plugin/ views/ filter/ Search.php - Search.php in core/
modules/ search/ src/ Plugin/ views/ argument/ Search.php - ViewsSearchQuery.php in core/
tests/ fixtures/ database_drivers/ module/ core_fake/ src/ Driver/ Database/ CoreFakeWithAllCustomClasses/ ViewsSearchQuery.php
File
-
core/
modules/ search/ src/ ViewsSearchQuery.php, line 10
Namespace
Drupal\searchView source
class ViewsSearchQuery extends SearchQuery {
/**
* Returns the conditions property.
*
* @return array
* The query conditions.
*/
public function &conditions() {
return $this->conditions;
}
/**
* Returns the words property.
*
* @return array
* The positive search keywords.
*/
public function words() {
return $this->words;
}
/**
* Returns the simple property.
*
* @return bool
* TRUE if it is a simple query, and FALSE if it is complicated (phrases
* or LIKE).
*/
public function simple() {
return $this->simple;
}
/**
* Returns the matches property.
*
* @return int
* The number of matches needed.
*/
public function matches() {
return $this->matches;
}
/**
* Executes and returns the protected parseSearchExpression method.
*/
public function publicParseSearchExpression() {
return $this->parseSearchExpression();
}
/**
* Replaces the original condition with a custom one from views recursively.
*
* @param string $search
* The searched value.
* @param string $replace
* The value which replaces the search value.
* @param array $condition
* The query conditions array in which the string is replaced. This is an
* item from a \Drupal\Core\Database\Query\Condition::conditions array,
* which must have a 'field' element.
*/
public function conditionReplaceString($search, $replace, &$condition) {
if ($condition['field'] instanceof ConditionInterface) {
$conditions =& $condition['field']->conditions();
foreach ($conditions as $key => &$subcondition) {
if (is_numeric($key)) {
// As conditions can be nested, the function has to be called
// recursively.
$this->conditionReplaceString($search, $replace, $subcondition);
}
}
}
else {
$condition['field'] = str_replace($search, $replace, $condition['field']);
}
}
}
Members
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.