Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
221
Merge Requests
221
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
8c30ce93
Commit
8c30ce93
authored
Jan 14, 2015
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2405907
by MrHaroldA: Views combined filters add redundant separators in CONCAT_WS()
parent
3fe7cb50
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
9 deletions
+44
-9
core/modules/views/src/Plugin/views/filter/Combine.php
core/modules/views/src/Plugin/views/filter/Combine.php
+1
-9
core/modules/views/src/Tests/Handler/FilterCombineTest.php
core/modules/views/src/Tests/Handler/FilterCombineTest.php
+43
-0
No files found.
core/modules/views/src/Plugin/views/filter/Combine.php
View file @
8c30ce93
...
...
@@ -77,15 +77,7 @@ public function query() {
}
}
if
(
$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
=
implode
(
', '
,
$fields
);
$expression
=
"CONCAT_WS(' ',
$expression
)"
;
$info
=
$this
->
operators
();
...
...
core/modules/views/src/Tests/Handler/FilterCombineTest.php
View file @
8c30ce93
...
...
@@ -81,6 +81,49 @@ 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.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment