diff --git a/lib/Drupal/views/Plugin/views/display/Attachment.php b/lib/Drupal/views/Plugin/views/display/Attachment.php index 0c6b5a49b7d0b23832f3757332f84fe3abe4a4aa..a83a54b7b8ff95791531c8a24db55e32f7f6ad78 100644 --- a/lib/Drupal/views/Plugin/views/display/Attachment.php +++ b/lib/Drupal/views/Plugin/views/display/Attachment.php @@ -25,7 +25,6 @@ * help = @Translation("Attachments added to other displays to achieve multiple views in the same view."), * theme = "views_view", * contextual_links_locations = {""}, - * use_ajax = TRUE, * use_pager = FALSE, * use_more = TRUE, * accept_attachments = FALSE, diff --git a/lib/Drupal/views/Plugin/views/display/Block.php b/lib/Drupal/views/Plugin/views/display/Block.php index 174d5bb6621ca9b071dd01ddfe9d09c8ad330d6a..e58b9e121cc5319474542613352c31933271c17c 100644 --- a/lib/Drupal/views/Plugin/views/display/Block.php +++ b/lib/Drupal/views/Plugin/views/display/Block.php @@ -22,7 +22,6 @@ * theme = "views_view", * uses_hook_block = TRUE, * contextual_links_locations = {"block"}, - * use_ajax = TRUE, * use_pager = TRUE, * use_more = TRUE, * accept_attachments = TRUE, @@ -204,7 +203,7 @@ function options_submit(&$form, &$form_state) { * Block views use exposed widgets only if AJAX is set. */ function uses_exposed() { - if ($this->use_ajax()) { + if ($this->isAJAXEnabled()) { return parent::uses_exposed(); } return FALSE; diff --git a/lib/Drupal/views/Plugin/views/display/DefaultDisplay.php b/lib/Drupal/views/Plugin/views/display/DefaultDisplay.php index c9d9936efa1c821e4a3f7e2bc5e6165559c68e1c..012e3404cec115d1e97262cac85d0934e1b21dcc 100644 --- a/lib/Drupal/views/Plugin/views/display/DefaultDisplay.php +++ b/lib/Drupal/views/Plugin/views/display/DefaultDisplay.php @@ -22,7 +22,6 @@ * theme = "views_view", * no_ui = TRUE, * no_remove = TRUE, - * use_ajax = TRUE, * use_pager = TRUE, * use_more = TRUE, * accept_attachments = TRUE, diff --git a/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php index d16267cfcc1a3ce33c391d7ee345ee628e2297e3..98a6dbc9a33b8bbbc9d6e696428f0828af22dbca 100644 --- a/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php +++ b/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php @@ -57,6 +57,13 @@ abstract class DisplayPluginBase extends PluginBase { */ public $output = NULL; + /** + * Whether the display allows the use of AJAX or not. + * + * @var bool + */ + protected $usesAJAX = TRUE; + function init(&$view, &$display, $options = NULL) { $this->view = &$view; $this->display = &$display; @@ -339,10 +346,21 @@ function displays_exposed() { } /** - * Does the display use AJAX? + * Whether the display allows the use of AJAX or not. + * + * @return bool + */ + function usesAJAX() { + return $this->usesAJAX; + } + + /** + * Whether the display is actually using AJAX or not. + * + * @return bool */ - function use_ajax() { - if (!empty($this->definition['use_ajax'])) { + function isAJAXEnabled() { + if ($this->usesAJAX()) { return $this->get_option('use_ajax'); } return FALSE; @@ -1239,7 +1257,7 @@ function options_summary(&$categories, &$options) { $options['row_plugin']['links']['row_options'] = t('Change settings for this style'); } } - if (!empty($this->definition['use_ajax'])) { + if ($this->usesAJAX()) { $options['use_ajax'] = array( 'category' => 'other', 'title' => t('Use AJAX'), @@ -2683,7 +2701,7 @@ function access($account = NULL) { * overridden on an individual display. */ function pre_execute() { - $this->view->set_use_ajax($this->use_ajax()); + $this->view->set_use_ajax($this->isAJAXEnabled()); if ($this->use_more() && !$this->use_more_always()) { $this->view->get_total_rows = TRUE; } diff --git a/lib/Drupal/views/Plugin/views/display/Embed.php b/lib/Drupal/views/Plugin/views/display/Embed.php index e445f9d000b2157419d9077e9aec1105293d4d60..7bb9f2ce2e1b59230ff129de2a928d98f15ad785 100644 --- a/lib/Drupal/views/Plugin/views/display/Embed.php +++ b/lib/Drupal/views/Plugin/views/display/Embed.php @@ -24,7 +24,6 @@ * help = @Translation("Provide a display which can be embedded using the views api."), * theme = "views_view", * uses_hook_menu = FALSE, - * use_ajax = TRUE, * use_pager = TRUE, * accept_attachments = FALSE, * help_topic = "display-embed" diff --git a/lib/Drupal/views/Plugin/views/display/Feed.php b/lib/Drupal/views/Plugin/views/display/Feed.php index b32d43ca9a6162131645233e0e377ec849c887f9..0203afdbc31af86f5a06076803de7185a041c881 100644 --- a/lib/Drupal/views/Plugin/views/display/Feed.php +++ b/lib/Drupal/views/Plugin/views/display/Feed.php @@ -23,7 +23,6 @@ * title = @Translation("Feed"), * help = @Translation("Display the view as a feed, such as an RSS feed."), * uses_hook_menu = TRUE, - * use_ajax = FALSE, * use_pager = FALSE, * accept_attachments = FALSE, * admin = @Translation("Feed"), @@ -32,6 +31,13 @@ */ class Feed extends Page { + /** + * Whether the display allows the use of AJAX or not. + * + * @var bool + */ + protected $usesAJAX = FALSE; + function init(&$view, &$display, $options = NULL) { parent::init($view, $display, $options); diff --git a/lib/Drupal/views/Plugin/views/display/Page.php b/lib/Drupal/views/Plugin/views/display/Page.php index a4fe689aa503cb27dfd51b3e37aea917ca75376f..3a442040ce7ed04fd85d4630ca55113fc0abe721 100644 --- a/lib/Drupal/views/Plugin/views/display/Page.php +++ b/lib/Drupal/views/Plugin/views/display/Page.php @@ -22,7 +22,6 @@ * uses_hook_menu = TRUE, * contextual_links_locations = {"page"}, * theme = "views_view", - * use_ajax = TRUE, * use_pager = TRUE, * use_more = TRUE, * accept_attachments = TRUE,