Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
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
drupal
Commits
77dbe358
There was an error fetching the commit references. Please try again later.
Commit
77dbe358
authored
1 year ago
by
Michael Strelan
Browse files
Options
Downloads
Patches
Plain Diff
Attempt to make RequestPath work without path_alias
parent
fb50edd8
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
core/modules/system/src/Plugin/Condition/RequestPath.php
+4
-4
4 additions, 4 deletions
core/modules/system/src/Plugin/Condition/RequestPath.php
with
4 additions
and
4 deletions
core/modules/system/src/Plugin/Condition/RequestPath.php
+
4
−
4
View file @
77dbe358
...
...
@@ -24,7 +24,7 @@ class RequestPath extends ConditionPluginBase implements ContainerFactoryPluginI
/**
* An alias manager to find the alias for the current system path.
*
* @var \Drupal\path_alias\AliasManagerInterface
* @var \Drupal\path_alias\AliasManagerInterface
|null
*/
protected
$aliasManager
;
...
...
@@ -67,7 +67,7 @@ class RequestPath extends ConditionPluginBase implements ContainerFactoryPluginI
* @param array $plugin_definition
* The plugin implementation definition.
*/
public
function
__construct
(
AliasManagerInterface
$alias_manager
,
PathMatcherInterface
$path_matcher
,
RequestStack
$request_stack
,
CurrentPathStack
$current_path
,
array
$configuration
,
$plugin_id
,
array
$plugin_definition
)
{
public
function
__construct
(
?
AliasManagerInterface
$alias_manager
,
PathMatcherInterface
$path_matcher
,
RequestStack
$request_stack
,
CurrentPathStack
$current_path
,
array
$configuration
,
$plugin_id
,
array
$plugin_definition
)
{
parent
::
__construct
(
$configuration
,
$plugin_id
,
$plugin_definition
);
$this
->
aliasManager
=
$alias_manager
;
$this
->
pathMatcher
=
$path_matcher
;
...
...
@@ -80,7 +80,7 @@ public function __construct(AliasManagerInterface $alias_manager, PathMatcherInt
*/
public
static
function
create
(
ContainerInterface
$container
,
array
$configuration
,
$plugin_id
,
$plugin_definition
)
{
return
new
static
(
$container
->
get
(
'path_alias.manager'
),
$container
->
has
(
'path_alias.manager'
)
?
$container
->
get
(
'path_alias.manager'
)
:
NULL
,
$container
->
get
(
'path.matcher'
),
$container
->
get
(
'request_stack'
),
$container
->
get
(
'path.current'
),
...
...
@@ -164,7 +164,7 @@ public function evaluate() {
$path
=
$this
->
currentPath
->
getPath
(
$request
);
// Do not trim a trailing slash if that is the complete path.
$path
=
$path
===
'/'
?
$path
:
rtrim
(
$path
,
'/'
);
$path_alias
=
mb_strtolower
(
$this
->
aliasManager
->
getAliasByPath
(
$path
));
$path_alias
=
$this
->
aliasManager
===
NULL
?
$path
:
mb_strtolower
(
$this
->
aliasManager
->
getAliasByPath
(
$path
));
return
$this
->
pathMatcher
->
matchPath
(
$path_alias
,
$pages
)
||
((
$path
!=
$path_alias
)
&&
$this
->
pathMatcher
->
matchPath
(
$path
,
$pages
));
}
...
...
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