/** * Overrides \Drupal\views\Plugin\views\SqlBase::buildOptionsForm(). */ public function buildOptionsForm(&$form, &$form_state) { parent::buildOptionsForm($form, $form_state); $form['quantity'] = array('#type' => 'number', '#title' => t('Number of pager links visible'), '#description' => t('Specify the number of links to pages to display in the pager.'), '#default_value' => $this->options['quantity']); $form['tags']['first'] = array('#type' => 'textfield', '#title' => t('First page link text'), '#default_value' => $this->options['tags']['first'], '#weight' => -10); $form['tags']['last'] = array('#type' => 'textfield', '#title' => t('Last page link text'), '#default_value' => $this->options['tags']['last'], '#weight' => 10); }
/** * {@inheritdoc} */ public function query() { parent::query(); // Don't query for the next page if we have a pager that has a limited // amount of pages. if ($this->getItemsPerPage() > 0 && (empty($this->options['total_pages']) || $this->getCurrentPage() < $this->options['total_pages'])) { // Increase the items in the query in order to be able to find out whether // there is another page. $limit = $this->view->query->getLimit(); $limit += 1; $this->view->query->setLimit($limit); } }
/** * Get the database without caching it. */ public function getDatabase() { $this->database = NULL; return parent::getDatabase(); }