Chris@0: conditions; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Returns the words property. Chris@0: * Chris@0: * @return array Chris@0: * The positive search keywords. Chris@0: */ Chris@0: public function words() { Chris@0: return $this->words; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Returns the simple property. Chris@0: * Chris@0: * @return bool Chris@0: * TRUE if it is a simple query, and FALSE if it is complicated (phrases Chris@0: * or LIKE). Chris@0: */ Chris@0: public function simple() { Chris@0: return $this->simple; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Returns the matches property. Chris@0: * Chris@0: * @return int Chris@0: * The number of matches needed. Chris@0: */ Chris@0: public function matches() { Chris@0: return $this->matches; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Executes and returns the protected parseSearchExpression method. Chris@0: */ Chris@0: public function publicParseSearchExpression() { Chris@0: return $this->parseSearchExpression(); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Replaces the original condition with a custom one from views recursively. Chris@0: * Chris@0: * @param string $search Chris@0: * The searched value. Chris@0: * @param string $replace Chris@0: * The value which replaces the search value. Chris@0: * @param array $condition Chris@0: * The query conditions array in which the string is replaced. This is an Chris@0: * item from a \Drupal\Core\Database\Query\Condition::conditions array, Chris@0: * which must have a 'field' element. Chris@0: */ Chris@0: public function conditionReplaceString($search, $replace, &$condition) { Chris@0: if ($condition['field'] instanceof Condition) { Chris@0: $conditions =& $condition['field']->conditions(); Chris@0: foreach ($conditions as $key => &$subcondition) { Chris@0: if (is_numeric($key)) { Chris@0: // As conditions can be nested, the function has to be called Chris@0: // recursively. Chris@0: $this->conditionReplaceString($search, $replace, $subcondition); Chris@0: } Chris@0: } Chris@0: } Chris@0: else { Chris@0: $condition['field'] = str_replace($search, $replace, $condition['field']); Chris@0: } Chris@0: } Chris@0: Chris@0: }