Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
entity_reference_edit_link
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_reference_edit_link
Commits
61e760cb
Commit
61e760cb
authored
11 months ago
by
Kostia Bohach
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3425102
: Add link to the Manage fields for the node type on the node edit page
parent
e935dba2
No related branches found
Branches containing commit
Tags
1.0.4
Tags containing commit
1 merge request
!4
Issue #3425102: Add link to the Manage fields for the node type on the node edit page
Pipeline
#108813
passed with warnings
11 months ago
Stage: build
Stage: validate
Stage: test
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
css/reference-field.css
+2
-2
2 additions, 2 deletions
css/reference-field.css
entity_reference_edit_link.module
+30
-1
30 additions, 1 deletion
entity_reference_edit_link.module
with
32 additions
and
3 deletions
css/reference-field.css
+
2
−
2
View file @
61e760cb
.field--widget-entity-reference-autocomplete
:has
(
.reference-edit-link
),
.field--widget-select2-entity-reference
:has
(
.reference-edit-link
)
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
flex-start
;
justify-content
:
space-between
;
}
.field--widget-select2-entity-reference
:has
(
.reference-edit-link
)
.form-type--select
{
...
...
@@ -29,7 +29,7 @@
}
.field--widget-entity-reference-autocomplete
.reference-link
.reference-edit-link
{
height
:
auto
;
margin-top
:
var
(
--space-s
);
margin-bottom
:
var
(
--space-s
);
height
:
auto
;
}
This diff is collapsed.
Click to expand it.
entity_reference_edit_link.module
+
30
−
1
View file @
61e760cb
...
...
@@ -5,10 +5,13 @@
* This is the module to create a drop-down menu for the core toolbar.
*/
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\Core\Render\Element
;
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\Core\Link
;
use
Drupal\Core\Url
;
use
Drupal\entity_reference_edit_link
\Plugin\Field\FieldWidget\EntityReferenceEditLinkAutocompleteTagsWidget
;
use
Drupal\entity_reference_edit_link
\Plugin\Field\FieldWidget\EntityReferenceEditLinkAutocompleteWidget
;
use
Drupal\node\NodeForm
;
/**
* Implements hook_preprocess_HOOK().
...
...
@@ -108,3 +111,29 @@ function entity_reference_edit_link_field_widget_complete_form_alter(&$field_wid
'_link'
=>
$link
,
];
}
/**
* Implements hook_form_alter().
*/
function
entity_reference_edit_link_form_alter
(
&
$form
,
FormStateInterface
$form_state
,
$form_id
)
{
$formObject
=
$form_state
->
getFormObject
();
// Currently worked only for the nodes.
if
(
!
$formObject
instanceof
NodeForm
||
$formObject
->
getOperation
()
!=
'edit'
)
{
return
;
}
$node
=
$formObject
->
getEntity
();
if
(
!
$node
)
{
return
;
}
$url
=
Url
::
fromRoute
(
"entity.
{
$node
->
getEntityTypeId
()
}
.field_ui_fields"
,
[
'node_type'
=>
$node
->
bundle
(),
],
[
'attributes'
=>
[
'target'
=>
'_blank'
],
]);
$form
[
'#title'
]
=
t
(
'<em>Edit @type</em> @title'
,
[
'@type'
=>
Link
::
fromTextAndUrl
(
node_get_type_label
(
$node
),
$url
)
->
toString
(),
'@title'
=>
$node
->
label
(),
]);
}
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