Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
double_reference
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
double_reference
Merge requests
!3
Resolve
#3506819
"Add better support"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Resolve
#3506819
"Add better support"
issue/double_reference-3506819:3506819-add-better-support
into
2.0.x
Overview
0
Commits
1
Pipelines
0
Changes
1
Open
Philip Frilling
requested to merge
issue/double_reference-3506819:3506819-add-better-support
into
2.0.x
2 months ago
Overview
0
Commits
1
Pipelines
0
Changes
1
Expand
Closes
#3506819
0
0
Merge request reports
Compare
2.0.x
version 1
8d820820
2 months ago
2.0.x (HEAD)
and
latest version
latest version
8d820820
1 commit,
2 months ago
version 1
8d820820
2 commits,
2 months ago
1 file
+
39
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
double_reference.module
0 → 100644
+
39
−
0
Options
<?php
/**
* @file
* double_reference.module.
*/
declare
(
strict_types
=
1
);
use
Drupal\field\FieldStorageConfigInterface
;
/**
* Implements hook_field_views_data_views_data_alter().
*/
function
double_reference_field_views_data_views_data_alter
(
array
&
$data
,
FieldStorageConfigInterface
$field
):
void
{
// Guard the field type.
if
(
$field
->
getType
()
!==
'double_reference'
)
{
return
;
}
$fieldName
=
$field
->
getName
();
$targetType
=
$field
->
getSetting
(
'target_type'
);
$arTargetType
=
$field
->
getSetting
(
'ar_target_type'
);
// Change the target_type filter to use the entity reference filter.
$data
[
"
{
$field
->
getTargetEntityTypeId
()
}
__
{
$fieldName
}
"
][
"
{
$fieldName
}
_target_id"
][
'filter'
][
'id'
]
=
match
(
$targetType
)
{
'taxonomy_term'
=>
'taxonomy_index_tid'
,
default
=>
'entity_reference'
,
};
// Change the ar_target_type filter to use the entity reference filter.
$data
[
"
{
$field
->
getTargetEntityTypeId
()
}
__
{
$fieldName
}
"
][
"
{
$fieldName
}
_ar_target_id"
][
'filter'
][
'id'
]
=
match
(
$arTargetType
)
{
'taxonomy_term'
=>
'taxonomy_index_tid'
,
default
=>
'entity_reference'
,
};
}
Loading