diff --git a/core/modules/views/src/Plugin/views/filter/Combine.php b/core/modules/views/src/Plugin/views/filter/Combine.php index 3bc05c6..9303024 100644 --- a/core/modules/views/src/Plugin/views/filter/Combine.php +++ b/core/modules/views/src/Plugin/views/filter/Combine.php @@ -136,37 +136,44 @@ function opEqual($expression) { protected function opContains($expression) { $placeholder = $this->placeholder(); - $this->query->addWhereExpression($this->options['group'], "$expression LIKE $placeholder", array($placeholder => '%' . Database::getConnection()->escapeLike($this->value) . '%')); + $operator = $this->getConditionOperator('LIKE'); + $this->query->addWhereExpression($this->options['group'], "$expression $operator $placeholder", array($placeholder => '%' . Database::getConnection()->escapeLike($this->value) . '%')); } protected function opStartsWith($expression) { $placeholder = $this->placeholder(); - $this->query->addWhereExpression($this->options['group'], "$expression LIKE $placeholder", array($placeholder => Database::getConnection()->escapeLike($this->value) . '%')); + $operator = $this->getConditionOperator('LIKE'); + $this->query->addWhereExpression($this->options['group'], "$expression $operator $placeholder", array($placeholder => Database::getConnection()->escapeLike($this->value) . '%')); } protected function opNotStartsWith($expression) { $placeholder = $this->placeholder(); - $this->query->addWhereExpression($this->options['group'], "$expression NOT LIKE $placeholder", array($placeholder => Database::getConnection()->escapeLike($this->value) . '%')); + $operator = $this->getConditionOperator('NOT LIKE'); + $this->query->addWhereExpression($this->options['group'], "$expression $operator $placeholder", array($placeholder => Database::getConnection()->escapeLike($this->value) . '%')); } protected function opEndsWith($expression) { $placeholder = $this->placeholder(); - $this->query->addWhereExpression($this->options['group'], "$expression LIKE $placeholder", array($placeholder => '%' . Database::getConnection()->escapeLike($this->value))); + $operator = $this->getConditionOperator('LIKE'); + $this->query->addWhereExpression($this->options['group'], "$expression $operator $placeholder", array($placeholder => '%' . Database::getConnection()->escapeLike($this->value))); } protected function opNotEndsWith($expression) { $placeholder = $this->placeholder(); - $this->query->addWhereExpression($this->options['group'], "$expression NOT LIKE $placeholder", array($placeholder => '%' . Database::getConnection()->escapeLike($this->value))); + $operator = $this->getConditionOperator('NOT LIKE'); + $this->query->addWhereExpression($this->options['group'], "$expression $operator $placeholder", array($placeholder => '%' . Database::getConnection()->escapeLike($this->value))); } protected function opNotLike($expression) { $placeholder = $this->placeholder(); - $this->query->addWhereExpression($this->options['group'], "$expression NOT LIKE $placeholder", array($placeholder => '%' . Database::getConnection()->escapeLike($this->value) . '%')); + $operator = $this->getConditionOperator('NOT LIKE'); + $this->query->addWhereExpression($this->options['group'], "$expression $operator $placeholder", array($placeholder => '%' . Database::getConnection()->escapeLike($this->value) . '%')); } protected function opRegex($expression) { $placeholder = $this->placeholder(); - $this->query->addWhereExpression($this->options['group'], "$expression REGEXP $placeholder", array($placeholder => $this->value)); + $operator = $this->getConditionOperator('REGEXP'); + $this->query->addWhereExpression($this->options['group'], "$expression $operator $placeholder", array($placeholder => $this->value)); } protected function opEmpty($expression) { diff --git a/core/modules/views/src/Plugin/views/filter/StringFilter.php b/core/modules/views/src/Plugin/views/filter/StringFilter.php index f5f46fc..8008eba 100644 --- a/core/modules/views/src/Plugin/views/filter/StringFilter.php +++ b/core/modules/views/src/Plugin/views/filter/StringFilter.php @@ -232,7 +232,20 @@ protected function valueForm(&$form, FormStateInterface $form_state) { } function operator() { - return $this->operator == '=' ? 'LIKE' : 'NOT LIKE'; + return $this->getConditionOperator($this->operator == '=' ? 'LIKE' : 'NOT LIKE'); + } + + /** + * Get specified condition operator mapping value. + * + * @param string $operator + * Condition operator. + * @return string + * Specified condition operator mapping value. + */ + public function getConditionOperator($operator) { + $mapping = Database::getConnection()->mapConditionOperator($operator); + return isset($mapping['operator']) ? $mapping['operator'] : $operator; } /**