Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
layout_builder_iframe_modal
Manage
Activity
Members
Labels
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drupal.org
layout_builder_iframe_modal
Commits
f3752e63
Commit
f3752e63
authored
3 years ago
by
Jan Hug
Browse files
Options
Downloads
Patches
Plain Diff
Improve checking which links to alter
parent
b2bc5a7d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
layout_builder_iframe_modal.module
+14
-6
14 additions, 6 deletions
layout_builder_iframe_modal.module
with
14 additions
and
6 deletions
layout_builder_iframe_modal.module
+
14
−
6
View file @
f3752e63
...
...
@@ -92,19 +92,27 @@ function layout_builder_iframe_modal_contextual_links_alter(array &$links, $grou
* Implements hook_link_alter().
*/
function
layout_builder_iframe_modal_link_alter
(
&
$variables
)
{
/** @var Drupal\Core\Url $url */
$url
=
$variables
[
'url'
];
$route_name
=
\Drupal
::
routeMatch
()
->
getRouteName
();
if
(
!
$url
||
!
$url
->
isRouted
())
{
// Only change links on layout builder routes.
if
(
strpos
(
$route_name
,
'layout_builder'
)
===
FALSE
)
{
return
;
}
if
(
empty
(
$variables
[
'options'
][
'attributes'
][
'class'
])
||
!
in_array
(
'use-ajax'
,
$variables
[
'options'
][
'attributes'
][
'class'
]))
{
// Only change links that open in a dialog.
if
(
empty
(
$variables
[
'options'
][
'attributes'
][
'data-dialog-type'
]))
{
return
;
}
/** @var Drupal\Core\Url $url */
$url
=
$variables
[
'url'
];
if
(
!
$url
||
!
$url
->
isRouted
())
{
return
;
}
$route_name
=
$url
->
getRouteName
();
if
(
!
_layout_builder_iframe_modal_is_layout_builder_route
(
$route_name
))
{
$
link_
route_name
=
$url
->
getRouteName
();
if
(
!
_layout_builder_iframe_modal_is_layout_builder_route
(
$
link_
route_name
))
{
return
;
}
...
...
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