X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fviews%2Fsrc%2FPlugin%2Fviews%2Fpager%2FPagerPluginBase.php;fp=web%2Fcore%2Fmodules%2Fviews%2Fsrc%2FPlugin%2Fviews%2Fpager%2FPagerPluginBase.php;h=52f4393d1575a34a486195522f77e0cd1cc5513d;hp=ec231a0b08c4f2f190f63e1ccb7c1a753d7da4dc;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/modules/views/src/Plugin/views/pager/PagerPluginBase.php b/web/core/modules/views/src/Plugin/views/pager/PagerPluginBase.php index ec231a0b0..52f4393d1 100644 --- a/web/core/modules/views/src/Plugin/views/pager/PagerPluginBase.php +++ b/web/core/modules/views/src/Plugin/views/pager/PagerPluginBase.php @@ -114,12 +114,12 @@ abstract class PagerPluginBase extends PluginBase { /** * Provide the default form form for validating options */ - public function validateOptionsForm(&$form, FormStateInterface $form_state) { } + public function validateOptionsForm(&$form, FormStateInterface $form_state) {} /** * Provide the default form form for submitting options */ - public function submitOptionsForm(&$form, FormStateInterface $form_state) { } + public function submitOptionsForm(&$form, FormStateInterface $form_state) {} /** * Return a string to display as the clickable title for the @@ -156,6 +156,8 @@ abstract class PagerPluginBase extends PluginBase { if (!empty($this->options['offset'])) { $this->total_items -= $this->options['offset']; } + // Prevent from being negative. + $this->total_items = max(0, $this->total_items); return $this->total_items; } @@ -173,22 +175,22 @@ abstract class PagerPluginBase extends PluginBase { * * This is called during the build phase and can directly modify the query. */ - public function query() { } + public function query() {} /** * Perform any needed actions just prior to the query executing. */ - public function preExecute(&$query) { } + public function preExecute(&$query) {} /** * Perform any needed actions just after the query executing. */ - public function postExecute(&$result) { } + public function postExecute(&$result) {} /** * Perform any needed actions just before rendering. */ - public function preRender(&$result) { } + public function preRender(&$result) {} /** * Return the renderable array of the pager. @@ -199,7 +201,7 @@ abstract class PagerPluginBase extends PluginBase { * Any extra GET parameters that should be retained, such as exposed * input. */ - public function render($input) { } + public function render($input) {} /** * Determine if there are more records available. @@ -211,11 +213,11 @@ abstract class PagerPluginBase extends PluginBase { && $this->total_items > (intval($this->current_page) + 1) * $this->getItemsPerPage(); } - public function exposedFormAlter(&$form, FormStateInterface $form_state) { } + public function exposedFormAlter(&$form, FormStateInterface $form_state) {} - public function exposedFormValidate(&$form, FormStateInterface $form_state) { } + public function exposedFormValidate(&$form, FormStateInterface $form_state) {} - public function exposedFormSubmit(&$form, FormStateInterface $form_state, &$exclude) { } + public function exposedFormSubmit(&$form, FormStateInterface $form_state, &$exclude) {} public function usesExposed() { return FALSE;