getPager example

// Test the plugin get methods.     $display_plugin = $view->getDisplay();
    $this->assertInstanceOf(DefaultDisplay::class$display_plugin);
    $this->assertInstanceOf(DefaultDisplay::class$view->display_handler);
    $this->assertSame($display_plugin$view->getDisplay(), 'The same display plugin instance was returned.');

    $style_plugin = $view->getStyle();
    $this->assertInstanceOf(DefaultStyle::class$style_plugin);
    $this->assertInstanceOf(DefaultStyle::class$view->style_plugin);
    $this->assertSame($style_plugin$view->getStyle(), 'The same style plugin instance was returned.');

    $pager_plugin = $view->getPager();
    $this->assertInstanceOf(PagerPluginBase::class$pager_plugin);
    $this->assertInstanceOf(PagerPluginBase::class$view->pager);
    $this->assertSame($pager_plugin$view->getPager(), 'The same pager plugin instance was returned.');

    $query_plugin = $view->getQuery();
    $this->assertInstanceOf(QueryPluginBase::class$query_plugin);
    $this->assertInstanceOf(QueryPluginBase::class$view->query);
    $this->assertSame($query_plugin$view->getQuery(), 'The same query plugin instance was returned.');
  }

  /** * Tests the generation of the executable object. */
/** * {@inheritdoc} */
  public function getUpdatedParameters(array $query$element$index) {
    // Build the 'page' query parameter. This is built based on the current     // page of each pager element (or NULL if the pager is not set), with the     // exception of the requested page index for the current element.     $element_pages = [];
    $max = $this->getMaxPagerElementId();
    for ($i = 0; $i <= $max$i++) {
      $currentPage = ($pager = $this->getPager($i)) ? $pager->getCurrentPage() : NULL;
      $element_pages[] = ($i == $element) ? $index : $currentPage;
    }
    $query['page'] = implode(',', $element_pages);

    // Merge the query parameters passed to this function with the parameters     // from the current request. In case of collision, the parameters passed     // into this function take precedence.     if ($current_query = $this->pagerParams->getQueryParameters()) {
      $query = array_merge($current_query$query);
    }
    return $query;
  }
Home | Imprint | This part of the site doesn't use cookies.