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
3039fe66
Commit
3039fe66
authored
11 months ago
by
Kostia Bohach
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3425639
: Content type edit link does not show with Gin theme
parent
61e760cb
No related branches found
Branches containing commit
Tags
2.0.4
Tags containing commit
1 merge request
!5
Issue #3425639: Content type edit link does not show with Gin theme
Pipeline
#115367
passed
11 months ago
Stage: build
Stage: validate
Stage: test
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
entity_reference_edit_link.module
+38
-5
38 additions, 5 deletions
entity_reference_edit_link.module
with
38 additions
and
5 deletions
entity_reference_edit_link.module
+
38
−
5
View file @
3039fe66
...
...
@@ -5,9 +5,9 @@
* This is the module to create a drop-down menu for the core toolbar.
*/
use
Drupal\Core\Render\Element
;
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\Core\Link
;
use
Drupal\Core\Render\Element
;
use
Drupal\Core\Url
;
use
Drupal\entity_reference_edit_link
\Plugin\Field\FieldWidget\EntityReferenceEditLinkAutocompleteTagsWidget
;
use
Drupal\entity_reference_edit_link
\Plugin\Field\FieldWidget\EntityReferenceEditLinkAutocompleteWidget
;
...
...
@@ -126,13 +126,46 @@ function entity_reference_edit_link_form_alter(&$form, FormStateInterface $form_
if
(
!
$node
)
{
return
;
}
$form
[
'#title'
]
=
entity_reference_edit_link_build_entity_type_link
(
$node
);
}
/**
* Implements hook_preprocess_HOOK().
*/
function
entity_reference_edit_link_preprocess_page_title
(
&
$variables
)
{
// To handle Gin theme node edit page structure.
$node
=
\Drupal
::
routeMatch
()
->
getParameter
(
'node'
);
// Only for the node edit pages.
if
(
!
$node
||
\Drupal
::
routeMatch
()
->
getRouteName
()
!=
'entity.node.edit_form'
)
{
return
;
}
$variables
[
'title'
]
=
entity_reference_edit_link_build_entity_type_link
(
$node
);
}
/**
* Implements hook_theme_registry_alter().
*/
function
entity_reference_edit_link_theme_registry_alter
(
&
$theme_registry
)
{
// To run module hook function before Gin theme functions.
foreach
(
$theme_registry
[
'page_title'
][
'preprocess functions'
]
as
$key
=>
$value
)
{
if
(
$value
==
'entity_reference_edit_link_preprocess_page_title'
)
{
unset
(
$theme_registry
[
'page_title'
][
'preprocess functions'
][
$key
]);
$theme_registry
[
'page_title'
][
'preprocess functions'
][]
=
$value
;
}
}
}
/**
* Implements hook_entity().
*/
function
entity_reference_edit_link_build_entity_type_link
(
$node
)
{
$url
=
Url
::
fromRoute
(
"entity.
{
$node
->
getEntityTypeId
()
}
.field_ui_fields"
,
[
'node_type'
=>
$node
->
bundle
(),
],
[
'attributes'
=>
[
'target'
=>
'_blank'
],
]);
$form
[
'#title'
]
=
t
(
'<em>Edit @type</em> @title'
,
[
[
'attributes'
=>
[
'target'
=>
'_blank'
],
]);
return
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