Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
field_inheritance
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
field_inheritance
Commits
09c7bd9e
Commit
09c7bd9e
authored
5 years ago
by
Owen Bush
Browse files
Options
Downloads
Patches
Plain Diff
Automatically add inherited field to manage display
parent
b1ecb5aa
Branches
generic-inheritance-plugin
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
field_inheritance.module
+7
-1
7 additions, 1 deletion
field_inheritance.module
with
7 additions
and
1 deletion
field_inheritance.module
+
7
−
1
View file @
09c7bd9e
...
...
@@ -44,6 +44,7 @@ function field_inheritance_entity_bundle_field_info_alter(&$fields, EntityTypeIn
if
(
!
empty
(
$inherited_field_ids
))
{
$inherited_fields
=
\Drupal
::
entityTypeManager
()
->
getStorage
(
'field_inheritance'
)
->
loadMultiple
(
$inherited_field_ids
);
if
(
!
empty
(
$inherited_fields
))
{
$x
=
0
;
foreach
(
$inherited_fields
as
$field
)
{
// We are only interested in adding computed fields to the destination
// entity type.
...
...
@@ -116,7 +117,12 @@ function field_inheritance_entity_bundle_field_info_alter(&$fields, EntityTypeIn
->
setTranslatable
(
FALSE
)
->
setRevisionable
(
FALSE
)
->
setReadOnly
(
TRUE
)
->
setDisplayConfigurable
(
'view'
,
TRUE
);
->
setDisplayConfigurable
(
'view'
,
TRUE
)
->
setDisplayOptions
(
'view'
,
[
'label'
=>
'visible'
,
'weight'
=>
(
50
+
$x
),
]);
$x
++
;
}
}
}
...
...
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