From 763caef9227c72cc6ae081031687cce6ffbac18f Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Wed, 10 Apr 2013 22:49:55 +0100 Subject: [PATCH] Issue #1831696 by dawehner, damiankloip | Bojhan: Fixed View page link goes nowhere, if you have not saved. --- .../lib/Drupal/views/Tests/UI/DisplayPath.php | 2 ++ .../views_ui/ViewEditFormController.php | 27 ++++++++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/core/modules/views/lib/Drupal/views/Tests/UI/DisplayPath.php b/core/modules/views/lib/Drupal/views/Tests/UI/DisplayPath.php index 3664f280b8e..af605777074 100644 --- a/core/modules/views/lib/Drupal/views/Tests/UI/DisplayPath.php +++ b/core/modules/views/lib/Drupal/views/Tests/UI/DisplayPath.php @@ -35,11 +35,13 @@ class DisplayPath extends UITestBase { // Add a new page display and check the appearing text. $this->drupalPost(NULL, array(), 'Add Page'); $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. $random_path = $this->randomName(); $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->assertLink(t('view @display', array('@display' => 'Page')), 0, 'view page link found on the page.'); } } diff --git a/core/modules/views/views_ui/lib/Drupal/views_ui/ViewEditFormController.php b/core/modules/views/views_ui/lib/Drupal/views_ui/ViewEditFormController.php index 48d195a0977..f965dbbfa49 100644 --- a/core/modules/views/views_ui/lib/Drupal/views_ui/ViewEditFormController.php +++ b/core/modules/views/views_ui/lib/Drupal/views_ui/ViewEditFormController.php @@ -376,10 +376,11 @@ class ViewEditFormController extends ViewFormControllerBase { "#suffix" => '', ); } - // Add a link to view the page. - elseif ($view->get('executable')->displayHandlers->get($display['id'])->hasPath()) { + // Add a link to view the page unless the view is disabled or has no + // path. + elseif ($view->status() && $view->get('executable')->displayHandlers->get($display['id'])->hasPath()) { $path = $view->get('executable')->displayHandlers->get($display['id'])->getPath(); - if (strpos($path, '%') === FALSE) { + if ($path && (strpos($path, '%') === FALSE)) { $build['top']['actions']['path'] = array( '#type' => 'link', '#title' => t('view @display', array('@display' => $display['display_title'])), @@ -409,16 +410,6 @@ class ViewEditFormController extends ViewFormControllerBase { '#prefix' => '
  • ', "#suffix" => '
  • ', ); - 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' => '
  • ', - "#suffix" => '
  • ', - ); - } foreach (views_fetch_plugin_names('display', NULL, array($view->get('storage')->get('base_table'))) as $type => $label) { if ($type == $display['display_plugin']) { @@ -445,6 +436,16 @@ class ViewEditFormController extends ViewFormControllerBase { "#suffix" => '', ); } + 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' => '
  • ', + "#suffix" => '
  • ', + ); + } $build['top']['actions']['suffix']['#markup'] = ''; // The area above the three columns.