diff --git a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php index 04e2f87..80a1326 100644 --- a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php +++ b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php @@ -1457,7 +1457,7 @@ protected function renderAsLink($alter, $text, $tokens) { } // The path has been heavily processed above, so it should be used as-is. - $final_url = CoreUrl::fromUri('user-path:' . $path, $options); + $final_url = CoreUrl::fromUri($path, $options); // Build the link based on our altered Url object, adding on the optional // prefix and suffix diff --git a/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php b/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php index 3d6f75e..c384cc7 100644 --- a/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php @@ -59,10 +59,10 @@ class FieldPluginBaseTest extends UnitTestCase { 'alias' => FALSE, 'entity' => NULL, 'entity_type' => NULL, - 'fragment' => NULL, 'html' => TRUE, 'language' => NULL, 'query' => [], + 'set_active_class' => FALSE, ]; /** @@ -266,7 +266,7 @@ public function testRenderAsLinkWithUrlAndOptions(Url $url, $alter, Url $expecte $field->field_alias = 'key'; $row = new ResultRow(['key' => 'value']); - $expected_url->setOptions($this->defaultUrlOptions + $expected_url->getOptions()); + $expected_url->setOptions($expected_url->getOptions() + $this->defaultUrlOptions); $expected_link_url->setUrlGenerator($this->urlGenerator); $expected_url_options = $expected_url->getOptions(); @@ -292,45 +292,46 @@ public function providerTestRenderAsLinkWithUrlAndOptions() { // Simple path with default options. $url = Url::fromRoute('test_route'); - $data[] = [$url, [], clone $url, '/test-path', clone $url, 'value']; + $data[]= [$url, [], clone $url, '/test-path', clone $url, 'value']; // Simple url with parameters. $url_parameters = Url::fromRoute('test_route', ['key' => 'value']); - $data[] = [$url_parameters, [], clone $url_parameters, '/test-path/value', clone $url_parameters, 'value']; + $data[]= [$url_parameters, [], clone $url_parameters, '/test-path/value', clone $url_parameters, 'value']; // Add a fragment. $url = Url::fromRoute('test_route'); $url_with_fragment = Url::fromRoute('test_route'); $options = ['fragment' => 'test'] + $this->defaultUrlOptions; $url_with_fragment->setOptions($options); - $data[] = [$url, ['fragment' => 'test'], $url_with_fragment, '/test-path', clone $url_with_fragment, 'value']; + $data[]= [$url, ['fragment' => 'test'], $url_with_fragment, '/test-path', clone $url_with_fragment, 'value']; // Rel attributes. $url = Url::fromRoute('test_route'); $url_with_rel = Url::fromRoute('test_route'); $options = ['attributes' => ['rel' => 'up']] + $this->defaultUrlOptions; - $url_with_rel->setOptions($options);$data[] = [$url, ['rel' => 'up'], clone $url, '/test-path', $url_with_rel, 'value']; + $url_with_rel->setOptions($options); + $data[]= [$url, ['rel' => 'up'], clone $url, '/test-path', $url_with_rel, 'value']; // Target attributes. $url = Url::fromRoute('test_route'); $url_with_target = Url::fromRoute('test_route'); $options = ['attributes' => ['target' => '_blank']] + $this->defaultUrlOptions; $url_with_target->setOptions($options); - $data[] = [$url, ['target' => '_blank'], $url_with_target, '/test-path', clone $url_with_target, 'value']; + $data[]= [$url, ['target' => '_blank'], $url_with_target, '/test-path', clone $url_with_target, 'value']; // Link attributes. $url = Url::fromRoute('test_route'); $url_with_link_attributes = Url::fromRoute('test_route'); $options = ['attributes' => ['foo' => 'bar']] + $this->defaultUrlOptions; $url_with_link_attributes->setOptions($options); - $data[] = [$url, ['link_attributes' => ['foo' => 'bar']], clone $url, '/test-path', $url_with_link_attributes, 'value']; + $data[]= [$url, ['link_attributes' => ['foo' => 'bar']], clone $url, '/test-path', $url_with_link_attributes, 'value']; // Manual specified query. $url = Url::fromRoute('test_route'); $url_with_query = Url::fromRoute('test_route'); $options = ['query' => ['foo' => 'bar']] + $this->defaultUrlOptions; $url_with_query->setOptions($options); - $data[] = [$url, ['query' => ['foo' => 'bar']], clone $url, '/test-path', $url_with_query, 'value']; + $data[]= [$url, ['query' => ['foo' => 'bar']], clone $url_with_query, '/test-path', $url_with_query, 'value']; // Query specified as part of the path. $url = Url::fromRoute('test_route')->setOption('query', ['foo' => 'bar']); @@ -343,7 +344,7 @@ public function providerTestRenderAsLinkWithUrlAndOptions() { $url_with_query = Url::fromRoute('test_route'); $options = ['query' => ['key' => 'value']] + $this->defaultUrlOptions; $url_with_query->setOptions($options); - $data[] = [$url, ['query' => ['key' => 'value']], clone $url, '/test-path?key=value', $url_with_query, 'value']; + $data[] = [$url, ['query' => ['key' => 'value']], clone $url_with_query, '/test-path?key=value', $url_with_query, 'value']; // Alias flag. $url = Url::fromRoute('test_route');