diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php index 57d832a..3390817 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php @@ -2429,7 +2429,7 @@ public function renderPager() { * Render the 'more' link */ public function renderMoreLink() { - if ($this->usesMore() && ($this->useMoreAlways() || (!empty($this->view->pager) && $this->view->pager->hasMoreRecords()))) { + if ($this->isMoreEnabled() && ($this->useMoreAlways() || (!empty($this->view->pager) && $this->view->pager->hasMoreRecords()))) { $path = $this->getPath(); if ($this->getOption('link_display') == 'custom_url' && $override_path = $this->getOption('link_url')) { @@ -2532,7 +2532,7 @@ public function access($account = NULL) { */ public function preExecute() { $this->view->setAjaxEnabled($this->ajaxEnabled()); - if ($this->usesMore() && !$this->useMoreAlways()) { + if ($this->isMoreEnabled() && !$this->useMoreAlways()) { $this->view->get_total_rows = TRUE; } $this->view->initHandlers(); diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayTest.php index f53946e..7be2305 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayTest.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\views\Tests\Plugin\DisplayTest. + * Contains \Drupal\views\Tests\Plugin\DisplayTest. */ namespace Drupal\views\Tests\Plugin; @@ -55,7 +55,7 @@ public function setUp() { * * @see Drupal\views_test_data\Plugin\views\display\DisplayTest */ - function testDisplayPlugin() { + public function testDisplayPlugin() { $view = views_get_view('test_view'); // Add a new 'display_test' display and test it's there. @@ -195,6 +195,36 @@ public function testReadMore() { // tested. $more_text = $view->display_handler->useMoreText(); $this->assertEqual($more_text, $expected_more_text, 'The right more text is chosen.'); + + $view = views_get_view('test_display_more'); + $view->setDisplay(); + $view->display_handler->setOption('use_more', 0); + $this->executeView($view); + $output = $view->preview(); + $output = drupal_render($output); + $this->drupalSetContent($output); + $result = $this->xpath('//div[@class=:class]/a', array(':class' => 'more-link')); + $this->assertTrue(empty($result), 'The more link is not shown.'); + + $view = views_get_view('test_display_more'); + $view->setDisplay(); + $view->display_handler->setOption('use_more', 0); + $view->display_handler->setOption('use_more_always', 0); + $view->display_handler->setOption('pager', array( + 'type' => 'some', + 'options' => array( + 'items_per_page' => 1, + 'offset' => 0, + ), + )); + $this->executeView($view); + $this->assertIdentical($view->get_total_rows, NULL, 'The query was not forced to calculate the total number of results.'); + $this->assertIdentical($view->total_rows, NULL, 'The query did not return the total number of rows.'); + $output = $view->preview(); + $output = drupal_render($output); + $this->drupalSetContent($output); + $result = $this->xpath('//div[@class=:class]/a', array(':class' => 'more-link')); + $this->assertTrue(empty($result), 'The more link is not shown when view has more records.'); } /** diff --git a/core/modules/views/lib/Drupal/views/ViewExecutable.php b/core/modules/views/lib/Drupal/views/ViewExecutable.php index 263df05..ba04946 100644 --- a/core/modules/views/lib/Drupal/views/ViewExecutable.php +++ b/core/modules/views/lib/Drupal/views/ViewExecutable.php @@ -105,7 +105,7 @@ class ViewExecutable { /** * The total number of rows returned from the query. * - * @var array + * @var int */ public $total_rows = NULL;