Commit 2acbaf25 authored by alexpott's avatar alexpott

Issue #2561943 by geertvd, pjonckiere, jhodgdon: Views UI - View Page link on...

Issue #2561943 by geertvd, pjonckiere, jhodgdon: Views UI - View Page link on Page display is broken
parent d7509fae
...@@ -57,7 +57,10 @@ protected function doBasicPathUITest() { ...@@ -57,7 +57,10 @@ protected function doBasicPathUITest() {
$this->drupalPostForm('admin/structure/views/nojs/display/test_view/page_1/path', array('path' => $random_path), t('Apply')); $this->drupalPostForm('admin/structure/views/nojs/display/test_view/page_1/path', array('path' => $random_path), t('Apply'));
$this->assertText('/' . $random_path, 'The custom path appears in the summary.'); $this->assertText('/' . $random_path, 'The custom path appears in the summary.');
$this->assertLink(t('View @display', array('@display' => 'Page')), 0, 'view page link found on the page.'); $display_link_text = t('View @display', ['@display' => 'Page']);
$this->assertLink($display_link_text, 0, 'view page link found on the page.');
$this->clickLink($display_link_text);
$this->assertUrl($random_path);
} }
/** /**
......
...@@ -414,14 +414,13 @@ public function getDisplayDetails($view, $display) { ...@@ -414,14 +414,13 @@ public function getDisplayDetails($view, $display) {
elseif ($view->status() && $view->getExecutable()->displayHandlers->get($display['id'])->hasPath()) { elseif ($view->status() && $view->getExecutable()->displayHandlers->get($display['id'])->hasPath()) {
$path = $view->getExecutable()->displayHandlers->get($display['id'])->getPath(); $path = $view->getExecutable()->displayHandlers->get($display['id'])->getPath();
if ($path && (strpos($path, '%') === FALSE)) { if ($path && (strpos($path, '%') === FALSE)) {
$uri = "base:$path";
if (!parse_url($path, PHP_URL_SCHEME)) { if (!parse_url($path, PHP_URL_SCHEME)) {
// @todo Views should expect and store a leading /. See: // @todo Views should expect and store a leading /. See:
// https://www.drupal.org/node/2423913 // https://www.drupal.org/node/2423913
$url = Url::fromUserInput('/' . ltrim($uri, '/')); $url = Url::fromUserInput('/' . ltrim($path, '/'));
} }
else { else {
$url = Url::fromUri($uri); $url = Url::fromUri("base:$path");
} }
$build['top']['actions']['path'] = array( $build['top']['actions']['path'] = array(
'#type' => 'link', '#type' => 'link',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment