summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranon2017-03-21 20:57:17 +0100
committerEmil Stjerneman2017-03-21 20:57:17 +0100
commitc03d1d7d91e536786db3741dfc504ce834c19f73 (patch)
tree4a4edb49c9b813a7f2f1bb5ad583c762b410ba49
parent15cc6175e75a27f513e979366af3e20d9be1a22e (diff)
Issue #2856732 by anon: Linking to files, do not use the domain?8.x-4.38.x-4.x
-rw-r--r--src/Plugin/Linkit/Matcher/EntityMatcher.php2
-rw-r--r--src/Plugin/Linkit/Matcher/FileMatcher.php3
-rw-r--r--src/Tests/Matchers/UserMatcherTest.php2
3 files changed, 4 insertions, 3 deletions
diff --git a/src/Plugin/Linkit/Matcher/EntityMatcher.php b/src/Plugin/Linkit/Matcher/EntityMatcher.php
index 98a1eb7..3383820 100644
--- a/src/Plugin/Linkit/Matcher/EntityMatcher.php
+++ b/src/Plugin/Linkit/Matcher/EntityMatcher.php
@@ -229,7 +229,7 @@ class EntityMatcher extends ConfigurableMatcherBase {
// Check the access against the defined entity access handler.
/** @var \Drupal\Core\Access\AccessResultInterface $access */
$access = $entity->access('view', $this->currentUser, TRUE);
- if ($access->isForbidden()) {
+ if (!$access->isAllowed()) {
continue;
}
diff --git a/src/Plugin/Linkit/Matcher/FileMatcher.php b/src/Plugin/Linkit/Matcher/FileMatcher.php
index 16f40ea..cb39ccf 100644
--- a/src/Plugin/Linkit/Matcher/FileMatcher.php
+++ b/src/Plugin/Linkit/Matcher/FileMatcher.php
@@ -183,6 +183,7 @@ class FileMatcher extends EntityMatcher {
* entity interface.
*/
protected function buildPath($entity) {
- return $entity->url();
+ /** @var \Drupal\file\FileInterface $entity */
+ return file_url_transform_relative(file_create_url($entity->getFileUri()));
}
}
diff --git a/src/Tests/Matchers/UserMatcherTest.php b/src/Tests/Matchers/UserMatcherTest.php
index b36d084..6150a11 100644
--- a/src/Tests/Matchers/UserMatcherTest.php
+++ b/src/Tests/Matchers/UserMatcherTest.php
@@ -35,7 +35,7 @@ class UserMatcherTest extends LinkitTestBase {
*/
protected function setUp() {
parent::setUp();
- $this->drupalLogin($this->adminUser);
+ $this->drupalLogin($this->drupalCreateUser(['access user profiles']));
$this->manager = $this->container->get('plugin.manager.linkit.matcher');
$custom_role = $this->drupalCreateRole(array(), 'custom_role', 'custom_role');