Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flexible_views
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
flexible_views
Commits
939ca78f
Commit
939ca78f
authored
3 years ago
by
Uttkarsh Tiwari
Committed by
David Bätge
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3247363
by u_tiwari: Compatibility with views_ef_fieldset module
parent
281e3b83
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
css/flexible-views-column-selector.css
+1
-1
1 addition, 1 deletion
css/flexible-views-column-selector.css
src/Plugin/views/filter/ColumnSelector.php
+47
-0
47 additions, 0 deletions
src/Plugin/views/filter/ColumnSelector.php
with
48 additions
and
1 deletion
css/flexible-views-column-selector.css
+
1
−
1
View file @
939ca78f
...
...
@@ -51,5 +51,5 @@
.js-form-item.form-item.form-item-selected-columns-submit-order
,
.js-form-item.form-item.form-item--selected-columns-submit-order
{
display
:
none
;
display
:
none
!important
;
}
This diff is collapsed.
Click to expand it.
src/Plugin/views/filter/ColumnSelector.php
+
47
−
0
View file @
939ca78f
...
...
@@ -3,6 +3,7 @@
namespace
Drupal\flexible_views\Plugin\views\filter
;
use
Drupal\Component\Serialization\Json
;
use
Drupal\Component\Utility\NestedArray
;
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\Core\Utility\TableSort
;
use
Drupal\views\Plugin\views\filter\FilterPluginBase
;
...
...
@@ -245,6 +246,25 @@ EOT;
// Clear the validation error on the selected_columns field. We supply an
// empty array [] as options, but the user can select something and this
// results in a validation error.
if
(
isset
(
$form
[
'filters'
])
&&
isset
(
$form
[
'filters'
][
'children'
]))
{
$parents
=
$this
->
getKey
(
$form
[
'filters'
],
[
'filters'
]);
if
(
$form_state
->
getError
(
NestedArray
::
getValue
(
$form
,
$parents
)))
{
$form_errors
=
$form_state
->
getErrors
();
// Clear the form errors.
$form_state
->
clearErrors
();
// Remove the form error.
unset
(
$form_errors
[
'selected_columns'
]);
// Now loop through and re-apply the remaining form error messages.
foreach
(
$form_errors
as
$name
=>
$error_message
)
{
$form_state
->
setErrorByName
(
$name
,
$error_message
);
}
}
return
;
}
// Do the same for a simpler structure.
if
(
$form_state
->
getError
(
$form
[
'flexible_tables_fieldset'
][
'selected_columns'
]))
{
$form_errors
=
$form_state
->
getErrors
();
...
...
@@ -261,6 +281,33 @@ EOT;
}
}
/**
* Helper method for getting form errors.
*
* @param array $subjectArray
* The form array to check.
* @param array $chain
* The selector chain.
*
* @see https://www.drupal.org/project/flexible_views/issues/3247363
*
* @return array
* The filled selector chain.
*/
public
function
getKey
(
array
$subjectArray
,
array
$chain
)
{
$result
=
NestedArray
::
getValue
(
$subjectArray
,
[
'children'
]);
foreach
(
$result
as
$key
=>
$values
)
{
if
(
strpos
(
$key
,
'container'
)
!==
FALSE
)
{
array_push
(
$chain
,
'children'
,
$key
);
break
;
}
if
(
$key
==
'flexible_tables_fieldset'
)
{
return
$chain
;
}
}
return
is_array
(
$values
)
?
$this
->
getKey
(
$values
,
$chain
)
:
[];
}
/**
* {@inheritdoc}
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment