Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
ui_suite_dsfr
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
ui_suite_dsfr
Commits
816bdb9a
There was an error fetching the commit references. Please try again later.
Commit
816bdb9a
authored
1 year ago
by
Pierre Dureau
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3414096
by Martygraphie, pdureau: add mailto protocol support to button & link preprocess
parent
583431f9
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
ui_suite_dsfr.theme
+9
-3
9 additions, 3 deletions
ui_suite_dsfr.theme
with
9 additions
and
3 deletions
ui_suite_dsfr.theme
+
9
−
3
View file @
816bdb9a
...
...
@@ -354,7 +354,9 @@ function ui_suite_dsfr_preprocess_pattern_link(array &$variables) {
if
(
empty
(
$variables
[
'url'
]))
{
return
;
}
if
(
UrlHelper
::
isExternal
(
$variables
[
'url'
])
// It seems UrlHelper::setAllowedProtocols() doesn't support mailto.
if
(
!
str_starts_with
(
strtolower
(
$variables
[
'url'
]),
'mailto:'
)
&&
UrlHelper
::
isExternal
(
$variables
[
'url'
])
&&
!
UrlHelper
::
externalIsLocal
(
$variables
[
'url'
],
\Drupal
::
request
()
->
getSchemeAndHttpHost
()))
{
$variables
[
'external'
]
=
TRUE
;
}
...
...
@@ -367,7 +369,9 @@ function ui_suite_dsfr_preprocess_pattern_button(array &$variables) {
if
(
empty
(
$variables
[
'url'
]))
{
return
;
}
if
(
UrlHelper
::
isExternal
(
$variables
[
'url'
])
// It seems UrlHelper::setAllowedProtocols() doesn't support mailto.
if
(
!
str_starts_with
(
strtolower
(
$variables
[
'url'
]),
'mailto:'
)
&&
UrlHelper
::
isExternal
(
$variables
[
'url'
])
&&
!
UrlHelper
::
externalIsLocal
(
$variables
[
'url'
],
\Drupal
::
request
()
->
getSchemeAndHttpHost
()))
{
$variables
[
'external'
]
=
TRUE
;
}
...
...
@@ -395,7 +399,9 @@ function ui_suite_dsfr_preprocess_pattern_footer_menu(array &$variables) {
if
(
empty
(
$item
[
'url'
]))
{
return
;
}
if
(
UrlHelper
::
isExternal
(
$item
[
'url'
])
// It seems UrlHelper::setAllowedProtocols() doesn't support mailto.
if
(
!
str_starts_with
(
strtolower
(
$item
[
'url'
]),
'mailto:'
)
&&
UrlHelper
::
isExternal
(
$item
[
'url'
])
&&
!
UrlHelper
::
externalIsLocal
(
$item
[
'url'
],
\Drupal
::
request
()
->
getSchemeAndHttpHost
()))
{
$item
[
'link_attributes'
][
'target'
]
=
'_blank'
;
}
...
...
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