diff --git a/core/modules/views/src/Plugin/views/filter/Combine.php b/core/modules/views/src/Plugin/views/filter/Combine.php index 31863c358c2a9ec5e1402ee4bd33c1d78b13e1a7..cad7eb9137dc3bbf33189f11077d2a6473423a11 100644 --- a/core/modules/views/src/Plugin/views/filter/Combine.php +++ b/core/modules/views/src/Plugin/views/filter/Combine.php @@ -77,7 +77,15 @@ public function query() { } } if ($fields) { - $expression = implode(', ', $fields); + $count = count($fields); + $separated_fields = array(); + foreach ($fields as $key => $field) { + $separated_fields[] = $field; + if ($key < $count-1) { + $separated_fields[] = "' '"; + } + } + $expression = implode(', ', $separated_fields); $expression = "CONCAT_WS(' ', $expression)"; $info = $this->operators(); diff --git a/core/modules/views/src/Tests/Handler/FilterCombineTest.php b/core/modules/views/src/Tests/Handler/FilterCombineTest.php index 4decd83d2ea190082995aba98c61c4a0003b3035..516c773a250768316376df30f09565271d0e74d1 100644 --- a/core/modules/views/src/Tests/Handler/FilterCombineTest.php +++ b/core/modules/views/src/Tests/Handler/FilterCombineTest.php @@ -81,49 +81,6 @@ public function testFilterCombineContains() { $this->assertIdenticalResultset($view, $resultset, $this->column_map); } - /** - * Tests filtering result using a phrase that matches combined fields. - */ - public function testFilterCombineContainsPhrase() { - $view = Views::getView('test_view'); - $view->setDisplay(); - - $fields = $view->displayHandlers->get('default')->getOption('fields'); - $view->displayHandlers->get('default')->overrideOption('fields', $fields + array( - 'job' => array( - 'id' => 'job', - 'table' => 'views_test_data', - 'field' => 'job', - 'relationship' => 'none', - ), - )); - - // Change the filtering. - $view->displayHandlers->get('default')->overrideOption('filters', array( - 'age' => array( - 'id' => 'combine', - 'table' => 'views', - 'field' => 'combine', - 'relationship' => 'none', - 'operator' => 'contains', - 'fields' => array( - 'name', - 'job', - ), - 'value' => 'ohn Si', - ), - )); - - $this->executeView($view); - $resultset = array( - array( - 'name' => 'John', - 'job' => 'Singer', - ), - ); - $this->assertIdenticalResultset($view, $resultset, $this->column_map); - } - /** * Tests if the filter can handle removed fields. *