15 votes
Accepted

How to add Pager to a custom page?

There are some examples on drupal.org of adding a pager to the page, if you want to use the one that core uses: https://api.drupal.org/api/drupal/core%21includes%21pager.inc/function/...
Kevin's user avatar
  • 27.8k
8 votes
Accepted

Views Rest Export and sending page numbers in it's response

As of now there is no way to display total page count in views rest export. But you can get total pages, current page, items per page and total number of items using new custom style in your custom ...
Vishal Patil's user avatar
  • 1,895
7 votes
Accepted

How to programmatically render a view pager?

The object returned from $views->pager() is an object implementing ViewsPluginInterface and extending PagerPluginBase. If you look at the parameters PagerPluginBase::render() accepts, you will see ...
apaderno's user avatar
  • 97.4k
4 votes
Accepted

Display all comments of node without pager (300+ comments)

It's stored in a variable per content type, you can override it like so: variable_set('comment_default_per_page_CONTENT_TYPE', 500); Where CONTENT_TYPE is the machine name of the content type. If ...
Clive's user avatar
  • 167k
4 votes
Accepted

How to add a pager at both the top and bottom of a View

Ok, I solved it. In my theme, I had copied all the content of classy theme because is like a copy of this. In the theme exist an "templeate" folder, this have another folder called "views" inside ...
JASHIROU PRO TIPS's user avatar
4 votes

Clean URL pagination (rewrite ?page=parameter)

You should write a PathProcessor that implements: Drupal\Core\PathProcessor\InboundPathProcessorInterface Drupal\Core\PathProcessor\OutboundPathProcessorInterface Example: file: modules/custom/...
Cesar Moore's user avatar
  • 1,538
3 votes

Multiple pagers in single page

You can use the element parameter: An optional integer to distinguish between multiple pagers on one page. e.g. First call: $output .= theme('pager', array('tags' => array(), 'element' => ...
Clive's user avatar
  • 167k
3 votes
Accepted

Using Migrate API with a multi-page / paginated source

https://www.drupal.org/node/2640516 is the issue to add this support to migrate_plus. In the meantime, in a case where I knew up front how many pages there were, I simply listed the pages in the urls ...
Mike Ryan's user avatar
  • 1,333
3 votes
Accepted

Pager with EntityQuery

Add the pager to the build array in which you return the results: return [ 'results' => [ '#theme' => 'mytheme_news_archive', '#items' => $nodes, '#path' => $path,...
4uk4's user avatar
  • 99.6k
3 votes
Accepted

How do I use paging in a content type containing a paragraph?

Build a view for paragraphs and place it in the content type with an EVA display (Entity Views Attachment). To do this add a EVA display, connect it to the node entity (content) and bundle (content ...
4uk4's user avatar
  • 99.6k
2 votes

Can we get full count of results from a query that is extended by PagerDefault

After executing a query extending PagerDefault, you can at any time after that (even between different functions) call a global that stored the total product count. // $results = $paged_query->...
JPMC's user avatar
  • 121
2 votes

How can I change the number of items in a view only for the first page?

This is how I got it working, use two hooks. Assuming we have a view called my_view and the display is page_1. Pre-build: Set the items per page to 10 for the first page. Pre-render: Add an additional ...
Tim's user avatar
  • 1,387
2 votes

Change views pager programmatically

For those using Drupal 8: If you're like me and made changes to your view in the 'hook_views_query_pre_render' hook then all you need to do to update the page is the following: $view->result = $...
ph08n1x's user avatar
  • 21
2 votes

Is there any way to adjust the items per block options?

Yes, the options are hardcoded in \Drupal\views\Plugin\views\display\Block::blockForm() (located in core/modules/views/src/Plugin/views/display/Block.php). It should be relatively possible to ...
Berdir's user avatar
  • 83.2k
2 votes

How to expose paging data in REST export views

Enable pager Exposed option "Allow user to control the number of items displayed in this view" in rest display, then build custom module with views style plugin - to return results and pager data, and ...
svetlio's user avatar
  • 1,504
2 votes
Accepted

How can I fix a pager limited to 2 pages?

You can set items per page for the Home page at Configuration/System/Site information/FRONT PAGE as shown in following image: And you can check also how many nodes you have promoted to the ...
CodeNext's user avatar
  • 3,719
2 votes
Accepted

Views pagination, jquery and ajax error

Views Ajax is same as the Drupal Ajax, ajax response also run the behaviors. What you need to do is removing the once() because it will stop your event binding for the second time. For preventing the ...
Jimmy Ko's user avatar
  • 2,871
2 votes

How to add Pager to a custom page?

As per change record pager_default_initialize() has been deprecated and new pager.manager service is created. $current_page = \Drupal::service('pager.manager')->createPager($total_count, $...
miststudent2011's user avatar
2 votes
Accepted

how can add pagination in custom module?

Issue seems to be that you are not attaching your global pager output with rest of content. Checkout the following code, slightly different but covers up the way to print the pager for a custom menu ...
arpitr's user avatar
  • 7,836
2 votes
Accepted

AJAXifying content and pagination problems

Try this below solution with views pager ajax enable. jQuery 1.7+ Version function runthiscode() { $(".pager a").each(function(){ $(".pager a").addClass("ajax-link"); $(".pager a").attr('...
Rishi's user avatar
  • 98
2 votes

Multiple pagers in single page

I've implemented the multipage on a single page in Drupal 8 Note:- The $element value is the key here. It should be same for both query extend and pager element. 100% working solution. Please find ...
Nandy_10's user avatar
2 votes
Accepted

Why doesn't my first blog entry show up on my last page?

It turns out that for some reason this particular blog entry had lost its selection of "Promoted to Front Page" in "Publishing". The content type is set to go to front page by default, and this entry ...
Eagle Gamma's user avatar
2 votes

Getting total count of query in combination with pager

// Use clone. $query = \Drupal::entityQuery('node'); $query->condition('status', 1); $query->condition('type', 'news'); $query->pager(9); **$count_query = clone $query;** $items = $query->...
Mykola Veryha's user avatar
2 votes

Rest API pagination

Ensure that you have the Full Pager enabled on the View. This will enable paging. Right now you’re only telling the view to show one thing.
Kevin's user avatar
  • 27.8k
2 votes

Add mini pager and infinite scroll to a view

You're description is a bit ambiguous because first you write Now after showing four items, 'load more' has to change to ' show less' and hide all four items but then below you write Also, ...
adrum99's user avatar
  • 189
2 votes

how rewrite pagination URL views for SEO?

In Drupal 7 you can use Query Parameters To URL but the D8 port needs more work. Maybe you can help with that in the course of the work for your current project? It's similar with Clean Pagination ...
prkos's user avatar
  • 7,131
2 votes
Accepted

How to add pagination to programmatically rendered search result template

I tried with the search_result template and it worked, hope this helps you : $output['prefix']['#markup'] = '<h2>Test page</h2>'; //This sets up necessary global variables for the type =&...
Shreya Shetty's user avatar
2 votes

How can I populate multiple blocks on a paginated page?

I think building this functionality using custom code would be the way to go as views isn't really capable of this sort of thing. If it was me I'd make a custom block to replicate this giving you ...
Leigh's user avatar
  • 2,953
2 votes

Creating a table with pagination in a Node Edit form

You can use tableselect instead of details something like: $query = \Drupal::database()->select('node', 'n') ->condition('type', 'article', '='); $query->fields('n', ['nid']); ...
berramou's user avatar
  • 7,185

Only top scored, non community-wiki answers of a minimum length are eligible