Commit 763caef9 authored by alexpott's avatar alexpott
Browse files

Issue #1831696 by dawehner, damiankloip | Bojhan: Fixed View page link goes...

Issue #1831696 by dawehner, damiankloip | Bojhan: Fixed View page link goes nowhere, if you have not saved.
parent 53532e96
...@@ -35,11 +35,13 @@ public function testPathUI() { ...@@ -35,11 +35,13 @@ public function testPathUI() {
// Add a new page display and check the appearing text. // Add a new page display and check the appearing text.
$this->drupalPost(NULL, array(), 'Add Page'); $this->drupalPost(NULL, array(), 'Add Page');
$this->assertText(t('No path is set'), 'The right text appears if no path was set.'); $this->assertText(t('No path is set'), 'The right text appears if no path was set.');
$this->assertNoLink(t('view @display', array('@display' => 'page')), 'No view page link found on the page.');
// Save a path and make sure the summary appears as expected. // Save a path and make sure the summary appears as expected.
$random_path = $this->randomName(); $random_path = $this->randomName();
$this->drupalPost("admin/structure/views/nojs/display/test_view/page_1/path", array('path' => $random_path), t('Apply')); $this->drupalPost("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.');
} }
} }
......
...@@ -376,10 +376,11 @@ public function getDisplayDetails($view, $display) { ...@@ -376,10 +376,11 @@ public function getDisplayDetails($view, $display) {
"#suffix" => '</li>', "#suffix" => '</li>',
); );
} }
// Add a link to view the page. // Add a link to view the page unless the view is disabled or has no
elseif ($view->get('executable')->displayHandlers->get($display['id'])->hasPath()) { // path.
elseif ($view->status() && $view->get('executable')->displayHandlers->get($display['id'])->hasPath()) {
$path = $view->get('executable')->displayHandlers->get($display['id'])->getPath(); $path = $view->get('executable')->displayHandlers->get($display['id'])->getPath();
if (strpos($path, '%') === FALSE) { if ($path && (strpos($path, '%') === FALSE)) {
$build['top']['actions']['path'] = array( $build['top']['actions']['path'] = array(
'#type' => 'link', '#type' => 'link',
'#title' => t('view @display', array('@display' => $display['display_title'])), '#title' => t('view @display', array('@display' => $display['display_title'])),
...@@ -409,16 +410,6 @@ public function getDisplayDetails($view, $display) { ...@@ -409,16 +410,6 @@ public function getDisplayDetails($view, $display) {
'#prefix' => '<li class="delete">', '#prefix' => '<li class="delete">',
"#suffix" => '</li>', "#suffix" => '</li>',
); );
if ($is_enabled) {
$build['top']['actions']['disable'] = array(
'#type' => 'submit',
'#value' => t('disable @display_title', array('@display_title' => $display_title)),
'#limit_validation_errors' => array(),
'#submit' => array(array($this, 'submitDisplayDisable'), array($this, 'submitDelayDestination')),
'#prefix' => '<li class="disable">',
"#suffix" => '</li>',
);
}
foreach (views_fetch_plugin_names('display', NULL, array($view->get('storage')->get('base_table'))) as $type => $label) { foreach (views_fetch_plugin_names('display', NULL, array($view->get('storage')->get('base_table'))) as $type => $label) {
if ($type == $display['display_plugin']) { if ($type == $display['display_plugin']) {
...@@ -445,6 +436,16 @@ public function getDisplayDetails($view, $display) { ...@@ -445,6 +436,16 @@ public function getDisplayDetails($view, $display) {
"#suffix" => '</li>', "#suffix" => '</li>',
); );
} }
if ($is_enabled) {
$build['top']['actions']['disable'] = array(
'#type' => 'submit',
'#value' => t('disable @display_title', array('@display_title' => $display_title)),
'#limit_validation_errors' => array(),
'#submit' => array(array($this, 'submitDisplayDisable'), array($this, 'submitDelayDestination')),
'#prefix' => '<li class="disable">',
"#suffix" => '</li>',
);
}
$build['top']['actions']['suffix']['#markup'] = '</ul>'; $build['top']['actions']['suffix']['#markup'] = '</ul>';
// The area above the three columns. // The area above the three columns.
......
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