diff --git a/core/modules/views/src/Plugin/views/pager/None.php b/core/modules/views/src/Plugin/views/pager/None.php index 69b05b85d5e8c361381657b6816e5d40390c8a95..3b9cd80954cc13c99681633d4089b61a71229967 100644 --- a/core/modules/views/src/Plugin/views/pager/None.php +++ b/core/modules/views/src/Plugin/views/pager/None.php @@ -31,6 +31,9 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, ?array &$ $this->setItemsPerPage(0); } + /** + * {@inheritdoc} + */ public function summaryTitle() { if (!empty($this->options['offset'])) { return $this->t('All items, skip @skip', ['@skip' => $this->options['offset']]); @@ -38,6 +41,9 @@ public function summaryTitle() { return $this->t('All items'); } + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); $options['offset'] = ['default' => 0]; @@ -59,26 +65,44 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ]; } + /** + * {@inheritdoc} + */ public function usePager() { return FALSE; } + /** + * {@inheritdoc} + */ public function useCountQuery() { return FALSE; } + /** + * {@inheritdoc} + */ public function getItemsPerPage() { return 0; } + /** + * {@inheritdoc} + */ public function executeCountQuery(&$count_query) { // If we are displaying all items, never count. But we can update the count in post_execute. } + /** + * {@inheritdoc} + */ public function postExecute(&$result) { $this->total_items = count($result); } + /** + * {@inheritdoc} + */ public function query() { // The only query modifications we might do are offsets. if (!empty($this->options['offset'])) { diff --git a/core/modules/views/src/Plugin/views/pager/PagerPluginBase.php b/core/modules/views/src/Plugin/views/pager/PagerPluginBase.php index 4d368a6a77170dfc82f69795ad7529767d217160..58436930fb3454f73841b71c16b0cecb2542ca10 100644 --- a/core/modules/views/src/Plugin/views/pager/PagerPluginBase.php +++ b/core/modules/views/src/Plugin/views/pager/PagerPluginBase.php @@ -252,20 +252,38 @@ public function hasMoreRecords() { && $this->total_items > (intval($this->current_page) + 1) * $this->getItemsPerPage(); } + /** + * Allows the exposed form to be altered. + */ public function exposedFormAlter(&$form, FormStateInterface $form_state) {} + /** + * Allows the exposed form to be validated. + */ public function exposedFormValidate(&$form, FormStateInterface $form_state) {} + /** + * Handles submission of the exposed form. + */ public function exposedFormSubmit(&$form, FormStateInterface $form_state, &$exclude) {} + /** + * Indicates whether this pager uses exposed filters. + */ public function usesExposed() { return FALSE; } + /** + * Returns whether the items per page is exposed. + */ protected function itemsPerPageExposed() { return FALSE; } + /** + * Returns whether the offset is exposed. + */ protected function isOffsetExposed() { return FALSE; } diff --git a/core/modules/views/src/Plugin/views/pager/Some.php b/core/modules/views/src/Plugin/views/pager/Some.php index a4ec41cbd49463c2f04de66a6c2143fe3276d291..505c56c9890b85917024f10f59bd221ed4e1bf47 100644 --- a/core/modules/views/src/Plugin/views/pager/Some.php +++ b/core/modules/views/src/Plugin/views/pager/Some.php @@ -19,6 +19,9 @@ )] class Some extends PagerPluginBase { + /** + * {@inheritdoc} + */ public function summaryTitle() { if (!empty($this->options['offset'])) { return $this->formatPlural($this->options['items_per_page'], '@count item, skip @skip', '@count items, skip @skip', ['@count' => $this->options['items_per_page'], '@skip' => $this->options['offset']]); @@ -26,6 +29,9 @@ public function summaryTitle() { return $this->formatPlural($this->options['items_per_page'], '@count item', '@count items', ['@count' => $this->options['items_per_page']]); } + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); $options['items_per_page'] = ['default' => 10]; @@ -57,14 +63,23 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ]; } + /** + * {@inheritdoc} + */ public function usePager() { return FALSE; } + /** + * {@inheritdoc} + */ public function useCountQuery() { return FALSE; } + /** + * {@inheritdoc} + */ public function query() { $this->view->query->setLimit($this->options['items_per_page']); $this->view->query->setOffset($this->options['offset']); diff --git a/core/modules/views/src/Plugin/views/pager/SqlBase.php b/core/modules/views/src/Plugin/views/pager/SqlBase.php index 5804ba275586a6884924de328ed43bd4429ce24a..5e16f90d87935872fa192a22ebc9dcd4f3a72939 100644 --- a/core/modules/views/src/Plugin/views/pager/SqlBase.php +++ b/core/modules/views/src/Plugin/views/pager/SqlBase.php @@ -62,6 +62,9 @@ public static function create(ContainerInterface $container, array $configuratio ); } + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); $options['items_per_page'] = ['default' => 10]; @@ -232,6 +235,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ]; } + /** + * {@inheritdoc} + */ public function validateOptionsForm(&$form, FormStateInterface $form_state) { // Only accept integer values. $error = FALSE; @@ -265,6 +271,9 @@ public function validateOptionsForm(&$form, FormStateInterface $form_state) { } } + /** + * {@inheritdoc} + */ public function query() { if ($this->itemsPerPageExposed()) { $query = $this->view->getRequest()->query; @@ -313,6 +322,9 @@ public function setCurrentPage($number = NULL) { $this->current_page = max(0, $this->pagerParameters->findPage($this->options['id'])); } + /** + * Gets the total number of pages. + */ public function getPagerTotal() { if ($items_per_page = intval($this->getItemsPerPage())) { return ceil($this->total_items / $items_per_page); @@ -347,18 +359,30 @@ public function updatePageInfo() { } } + /** + * {@inheritdoc} + */ public function usesExposed() { return $this->itemsPerPageExposed() || $this->isOffsetExposed(); } + /** + * {@inheritdoc} + */ protected function itemsPerPageExposed() { return !empty($this->options['expose']['items_per_page']); } + /** + * {@inheritdoc} + */ protected function isOffsetExposed() { return !empty($this->options['expose']['offset']); } + /** + * {@inheritdoc} + */ public function exposedFormAlter(&$form, FormStateInterface $form_state) { if ($this->itemsPerPageExposed()) { $options = explode(',', $this->options['expose']['items_per_page_options']); @@ -390,6 +414,9 @@ public function exposedFormAlter(&$form, FormStateInterface $form_state) { } } + /** + * {@inheritdoc} + */ public function exposedFormValidate(&$form, FormStateInterface $form_state) { if (!$form_state->isValueEmpty('offset') && trim($form_state->getValue('offset'))) { if (!is_numeric($form_state->getValue('offset')) || $form_state->getValue('offset') < 0) { diff --git a/core/modules/views/src/Plugin/views/style/DefaultSummary.php b/core/modules/views/src/Plugin/views/style/DefaultSummary.php index 56b875dc139546fe067e99642981f815466132a1..7d8ca4406a159bdaba361489f60cc35b1803460b 100644 --- a/core/modules/views/src/Plugin/views/style/DefaultSummary.php +++ b/core/modules/views/src/Plugin/views/style/DefaultSummary.php @@ -20,6 +20,9 @@ )] class DefaultSummary extends StylePluginBase { + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); @@ -31,12 +34,18 @@ protected function defineOptions() { return $options; } + /** + * {@inheritdoc} + */ public function query() { if (!empty($this->options['override'])) { $this->view->setItemsPerPage(intval($this->options['items_per_page'])); } } + /** + * {@inheritdoc} + */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { $form['base_path'] = [ '#type' => 'textfield', @@ -71,6 +80,9 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ]; } + /** + * {@inheritdoc} + */ public function render() { $rows = []; foreach ($this->view->result as $row) { diff --git a/core/modules/views/src/Plugin/views/style/Rss.php b/core/modules/views/src/Plugin/views/style/Rss.php index 206739403c44f75a21f4a4af5f7273dfefd841ab..9245a5afabff5fcc3c95fc30a20c2845ec863602 100644 --- a/core/modules/views/src/Plugin/views/style/Rss.php +++ b/core/modules/views/src/Plugin/views/style/Rss.php @@ -37,6 +37,9 @@ class Rss extends StylePluginBase { */ protected $usesRowPlugin = TRUE; + /** + * Attaches the RSS icon and feed link to the view. + */ public function attachTo(array &$build, $display_id, Url $feed_url, $title) { $url_options = []; $input = $this->view->getExposedInput(); @@ -63,6 +66,9 @@ public function attachTo(array &$build, $display_id, Url $feed_url, $title) { ]; } + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); @@ -71,6 +77,9 @@ protected function defineOptions() { return $options; } + /** + * {@inheritdoc} + */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); @@ -108,6 +117,9 @@ public function getDescription() { return $description; } + /** + * {@inheritdoc} + */ public function render() { $rows = []; diff --git a/core/modules/views/src/Plugin/views/style/Table.php b/core/modules/views/src/Plugin/views/style/Table.php index 56d6b0324260379f71c5c31c1d4baac4bf564a6d..746580894198f923aabe14a817bc8bc9a4e798ca 100644 --- a/core/modules/views/src/Plugin/views/style/Table.php +++ b/core/modules/views/src/Plugin/views/style/Table.php @@ -64,6 +64,9 @@ class Table extends StylePluginBase implements CacheableDependencyInterface { */ public $order; + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); @@ -413,10 +416,16 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) { ]; } + /** + * {@inheritdoc} + */ public function evenEmpty() { return parent::evenEmpty() || !empty($this->options['empty_table']); } + /** + * {@inheritdoc} + */ public function wizardSubmit(&$form, FormStateInterface $form_state, WizardInterface $wizard, &$display_options, $display_type) { // If any of the displays use the table style, make sure that the fields // always have a labels by unsetting the override. diff --git a/core/modules/views/src/Plugin/views/style/UnformattedSummary.php b/core/modules/views/src/Plugin/views/style/UnformattedSummary.php index 4ae4e96ef1c9b05dfcec4ae3d0ff29b72a49ebfa..68a86c96cc3b4b2a6e352e7f29e0817804615994 100644 --- a/core/modules/views/src/Plugin/views/style/UnformattedSummary.php +++ b/core/modules/views/src/Plugin/views/style/UnformattedSummary.php @@ -20,6 +20,9 @@ )] class UnformattedSummary extends DefaultSummary { + /** + * {@inheritdoc} + */ protected function defineOptions() { $options = parent::defineOptions(); $options['inline'] = ['default' => FALSE]; @@ -27,6 +30,9 @@ protected function defineOptions() { return $options; } + /** + * {@inheritdoc} + */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['inline'] = [ diff --git a/core/phpcs.xml.dist b/core/phpcs.xml.dist index ae70a1eb056f12b1c8fbbf3c47cdd40251ce7f27..71be430a339f19966c481ba8bd24c5ae1f04abbf 100644 --- a/core/phpcs.xml.dist +++ b/core/phpcs.xml.dist @@ -78,6 +78,8 @@ <include-pattern>core/modules/*/Plugin/views/display/*</include-pattern> <include-pattern>core/modules/*/Plugin/views/exposed_form/*</include-pattern> <include-pattern>core/modules/*/Plugin/views/field/*</include-pattern> + <include-pattern>core/modules/*/Plugin/views/pager/*</include-pattern> + <include-pattern>core/modules/*/Plugin/views/style/*</include-pattern> <include-pattern>*/Database/*</include-pattern> <exclude-pattern>*/tests/*</exclude-pattern> </rule>