Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
views_csv_source
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
views_csv_source
Merge requests
!6
Update 3 files
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Update 3 files
issue/views_csv_source-3446008:3446008-fix-contextual-filters
into
1.0.x
Overview
0
Commits
2
Pipelines
3
Changes
3
Merged
Daniel Cothran
requested to merge
issue/views_csv_source-3446008:3446008-fix-contextual-filters
into
1.0.x
10 months ago
Overview
0
Commits
2
Pipelines
3
Changes
3
Expand
/src/Plugin/views/argument/ViewsCsvUriParam.php
/views_csv_source.views.inc
/src/Plugin/views/argument/ViewsCsvArgument.php
Closes
#3446008
0
0
Merge request reports
Compare
1.0.x
version 2
7f3025eb
10 months ago
version 1
6cb96e57
10 months ago
1.0.x (base)
and
latest version
latest version
7f3025eb
2 commits,
10 months ago
version 2
7f3025eb
2 commits,
10 months ago
version 1
6cb96e57
1 commit,
10 months ago
3 files
+
33
−
45
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
src/Plugin/views/argument/ViewsCsvArgument.php
+
33
−
3
Options
@@ -3,7 +3,7 @@
namespace
Drupal\views_csv_source\Plugin\views\argument
;
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\views\Plugin\views\argument\Argument
PluginBase
;
use
Drupal\views\Plugin\views\argument\
String
Argument
;
use
Drupal\views_csv_source
\Plugin\views\ColumnSelectorTrait
;
/**
@@ -13,15 +13,44 @@ use Drupal\views_csv_source\Plugin\views\ColumnSelectorTrait;
*
* @ViewsArgument("views_csv_source_argument")
*/
class
ViewsCsvArgument
extends
Argument
PluginBase
{
class
ViewsCsvArgument
extends
String
Argument
{
use
ColumnSelectorTrait
;
/**
* Build the summary query based on a string.
*/
protected
function
summaryQuery
()
{
$this
->
ensureMyTable
();
}
/**
* Add this filter to the query.
*/
public
function
query
(
$group_by
=
FALSE
)
{
$this
->
query
->
addFilter
(
$this
);
$argument
=
$this
->
argument
;
if
(
!
empty
(
$this
->
options
[
'transform_dash'
]))
{
$argument
=
strtr
(
$argument
,
'-'
,
' '
);
}
if
(
!
empty
(
$this
->
options
[
'break_phrase'
]))
{
$this
->
unpackArgumentValue
();
}
else
{
$this
->
value
=
[
$argument
];
$this
->
operator
=
'or'
;
}
$this
->
ensureMyTable
();
if
(
empty
(
$this
->
options
[
'glossary'
]))
{
$field
=
$this
->
options
[
'key'
];
}
if
(
count
(
$this
->
value
)
>
1
)
{
$argument
=
$this
->
value
;
}
$this
->
query
->
addWhere
(
0
,
$field
,
$argument
,
'='
);
}
/**
@@ -48,6 +77,7 @@ class ViewsCsvArgument extends ArgumentPluginBase {
* {@inheritdoc}
*/
public
function
buildOptionsForm
(
&
$form
,
FormStateInterface
$form_state
)
{
parent
::
buildOptionsForm
(
$form
,
$form_state
);
$form
=
$this
->
buildKeyOptionElement
(
$form
);
}
Loading