Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Issue forks
linkit-2886455
Commits
192fe948
Commit
192fe948
authored
Apr 07, 2020
by
Len Swaneveld
Committed by
Emil Stjerneman
Apr 07, 2020
Browse files
Issue
#3108030
by Lendude, anon: Media links with standalone_url on are broken
parent
63e545bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Plugin/Linkit/Matcher/EntityMatcher.php
View file @
192fe948
...
...
@@ -497,7 +497,7 @@ class EntityMatcher extends ConfigurableMatcherBase {
// by $entity->toUrl().
if
(
$entity
->
getEntityTypeId
()
==
'media'
)
{
$standalone_url
=
\
Drupal
::
config
(
'media.settings'
)
->
get
(
'standalone_url'
);
if
(
$standalone_url
)
{
if
(
!
$standalone_url
)
{
// Strip "/edit".
$path
=
substr
(
$path
,
0
,
-
5
);
}
...
...
tests/src/Kernel/Matchers/MediaMatcherTest.php
View file @
192fe948
...
...
@@ -36,6 +36,7 @@ class MediaMatcherTest extends LinkitKernelTestBase {
$this
->
installEntitySchema
(
'file'
);
$this
->
installEntitySchema
(
'media'
);
$this
->
installConfig
([
'media'
]);
$this
->
installSchema
(
'system'
,
[
'key_value_expire'
]);
$this
->
installSchema
(
'file'
,
[
'file_usage'
]);
...
...
@@ -89,16 +90,17 @@ class MediaMatcherTest extends LinkitKernelTestBase {
// Verify suggestion paths.
foreach
(
$suggestions
->
getSuggestions
()
as
$key
=>
$suggestion
)
{
$this
->
assertEquals
(
'/media/'
.
(
$key
+
1
)
.
'/edit'
,
$suggestion
->
getPath
());
$this
->
assertEquals
(
'/media/'
.
(
$key
+
1
),
$suggestion
->
getPath
());
}
// Enable stand-alone URLs for media entities.
$config
=
\
Drupal
::
service
(
'config.factory'
)
->
getEditable
(
'media.settings'
);
$config
->
set
(
'standalone_url'
,
TRUE
)
->
save
();
drupal_flush_all_caches
();
$suggestions
=
$plugin
->
execute
(
'image-test'
);
// Re-verify suggestion paths.
// Re-verify suggestion paths
, they should not contain /edit
.
foreach
(
$suggestions
->
getSuggestions
()
as
$key
=>
$suggestion
)
{
$this
->
assertEquals
(
'/media/'
.
(
$key
+
1
),
$suggestion
->
getPath
());
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment