diff --git a/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php b/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php index 56a25cb4d29..b8a7952b725 100644 --- a/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php +++ b/core/modules/block/lib/Drupal/block/Plugin/views/display/Block.php @@ -176,7 +176,7 @@ class Block extends DisplayPluginBase { * Block views use exposed widgets only if AJAX is set. */ public function usesExposed() { - if ($this->isAJAXEnabled()) { + if ($this->ajaxEnabled()) { return parent::usesExposed(); } return FALSE; 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 0c4d150e200..23bdb53bcf1 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 @@ -244,7 +244,7 @@ abstract class DisplayPluginBase extends PluginBase { * * @return bool */ - public function isAJAXEnabled() { + public function ajaxEnabled() { if ($this->usesAJAX()) { return $this->getOption('use_ajax'); } @@ -2488,7 +2488,7 @@ abstract class DisplayPluginBase extends PluginBase { * overridden on an individual display. */ public function preExecute() { - $this->view->setUseAJAX($this->isAJAXEnabled()); + $this->view->setAjaxEnabled($this->ajaxEnabled()); if ($this->usesMore() && !$this->useMoreAlways()) { $this->view->get_total_rows = TRUE; } diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/Feed.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/Feed.php index a1d48f36e05..1fe792dae7d 100644 --- a/core/modules/views/lib/Drupal/views/Plugin/views/display/Feed.php +++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/Feed.php @@ -33,7 +33,7 @@ class Feed extends PathPluginBase { * * @var bool */ - protected $usesAJAX = FALSE; + protected $ajaxEnabled = FALSE; /** * Whether the display allows the use of a pager or not. diff --git a/core/modules/views/lib/Drupal/views/Tests/Plugin/PagerTest.php b/core/modules/views/lib/Drupal/views/Tests/Plugin/PagerTest.php index b8d2e74d5b1..6be2dc846ea 100644 --- a/core/modules/views/lib/Drupal/views/Tests/Plugin/PagerTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/Plugin/PagerTest.php @@ -250,7 +250,8 @@ class PagerTest extends PluginTestBase { } $view = views_get_view('test_pager_full'); $this->executeView($view); - $view->use_ajax = TRUE; // force the value again here + // Force the value again here. + $view->setAjaxEnabled(TRUE); $view->pager = NULL; $output = $view->render(); $output = drupal_render($output); diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php b/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php index 8f849417dc4..ea3a87cf6d1 100644 --- a/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/ViewExecutableTest.php @@ -57,7 +57,6 @@ class ViewExecutableTest extends ViewUnitTestBase { 'executed', 'args', 'build_info', - 'use_ajax', 'result', 'attachment_before', 'attachment_after', @@ -201,10 +200,10 @@ class ViewExecutableTest extends ViewUnitTestBase { public function testPropertyMethods() { $view = views_get_view('test_executable_displays'); - // Test the setUseAJAX() method. - $this->assertFalse($view->use_ajax); - $view->setUseAJAX(TRUE); - $this->assertTrue($view->use_ajax); + // Test the setAjaxEnabled() method. + $this->assertFalse($view->ajaxEnabled()); + $view->setAjaxEnabled(TRUE); + $this->assertTrue($view->ajaxEnabled()); $view->setDisplay(); // There should be no pager set initially. diff --git a/core/modules/views/lib/Drupal/views/ViewExecutable.php b/core/modules/views/lib/Drupal/views/ViewExecutable.php index 3a824400b51..05f6f37e208 100644 --- a/core/modules/views/lib/Drupal/views/ViewExecutable.php +++ b/core/modules/views/lib/Drupal/views/ViewExecutable.php @@ -67,7 +67,7 @@ class ViewExecutable { * * @var bool */ - public $use_ajax = FALSE; + protected $ajaxEnabled = FALSE; /** * Where the results of a query will go. @@ -533,12 +533,27 @@ class ViewExecutable { } /** - * Whether or not AJAX should be used. If AJAX is used, paging, - * tablesorting and exposed filters will be fetched via an AJAX call - * rather than a page refresh. + * Sets whether or not AJAX should be used. + * + * If AJAX is used, paging, tablesorting and exposed filters will be fetched + * via an AJAX call rather than a page refresh. + * + * @param bool $use_ajax + * TRUE if AJAX should be used, FALSE otherwise. */ - public function setUseAJAX($use_ajax) { - $this->use_ajax = $use_ajax; + public function setAjaxEnabled($ajax_enabled) { + $this->ajaxEnabled = (bool) $ajax_enabled; + } + + /** + * Whether or not AJAX should be used. + * + * @see \Drupal\views\ViewExecutable::setAjaxEnabled(). + * + * @return bool + */ + public function ajaxEnabled() { + return $this->ajaxEnabled; } /** diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc index 395f27587ec..35ca43486c8 100644 --- a/core/modules/views/views.theme.inc +++ b/core/modules/views/views.theme.inc @@ -130,7 +130,7 @@ function template_preprocess_views_view(&$vars) { } // If using AJAX, send identifying data about this view. - if ($view->use_ajax && empty($view->is_attachment) && empty($view->live_preview)) { + if ($view->ajaxEnabled() && empty($view->is_attachment) && empty($view->live_preview)) { $settings = array( 'views' => array( 'ajax_path' => url('views/ajax'),