Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
entity_hierarchy
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
entity_hierarchy
Commits
6e0ffece
Commit
6e0ffece
authored
1 year ago
by
Adam Bramley
Browse files
Options
Downloads
Patches
Plain Diff
Use entity_reference for target_id filter
parent
ca41be54
No related branches found
No related tags found
1 merge request
!40
Use entity_reference for target_id filter
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
entity_hierarchy.views.inc
+3
-0
3 additions, 0 deletions
entity_hierarchy.views.inc
tests/src/Kernel/ViewsIntegrationTest.php
+8
-0
8 additions, 0 deletions
tests/src/Kernel/ViewsIntegrationTest.php
with
11 additions
and
0 deletions
entity_hierarchy.views.inc
+
3
−
0
View file @
6e0ffece
...
...
@@ -198,6 +198,9 @@ function entity_hierarchy_field_views_data(FieldStorageConfigInterface $field_st
'field table'
=>
$table_mapping
->
getDedicatedDataTableName
(
$field_storage
),
'field field'
=>
$field_name
.
'_target_id'
,
];
// Change to use entity reference filter instead of numeric.
$data
[
$table_name
][
"
{
$field_name
}
_target_id"
][
'filter'
][
'id'
]
=
'entity_reference'
;
}
return
$data
;
...
...
This diff is collapsed.
Click to expand it.
tests/src/Kernel/ViewsIntegrationTest.php
+
8
−
0
View file @
6e0ffece
...
...
@@ -487,4 +487,12 @@ class ViewsIntegrationTest extends EntityHierarchyKernelTestBase {
]);
}
/**
* Tests target_id filter uses core's entity_reference plugin.
*/
public
function
testEntityReferenceFilterHandler
():
void
{
$data
=
\Drupal
::
service
(
'views.views_data'
)
->
getAll
();
$this
->
assertEquals
(
'entity_reference'
,
$data
[
$this
->
parent
->
getEntityTypeId
()
.
'__parents'
][
'parents_target_id'
][
'filter'
][
'id'
]);
}
}
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