Hot answers tagged

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.5k
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,865
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
  • 96.8k
5 votes

Views Slideshow - Bullets or Numbered Pager not displaying

You can achieve pager using View Slideshow by following steps: Step 1: In view, add Global: View result counter field and mark it as Exclude from display. Step 2: Now click on Slideshow format ...
Nikhil Banait's user avatar
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
  • 166k
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,528
3 votes
Accepted

why views items per page set to specific values

To be brutally simple: Because someone thought it to be good UX, maintainers agreed, and no one convinced them other way since then. That's all to it. There are many reasons for drop-down instead of ...
Mołot's user avatar
  • 21.9k
3 votes
Accepted

How to use pager_default_initialize with entity field query?

If your motive is to create a pager for those results, I suggest you to use ->pager() on your EntityFieldQuery. See this question EntityFieldQuery display pager if ($type == 21) { $query = new ...
Sujith N's user avatar
  • 113
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

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
  • 166k
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
  • 97k
3 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
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,367
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
Accepted

Views Calendar Pager Skips a Month Forward

This is a bug in the Date module, fixed by this simple RTBC patch in comment #35 https://www.drupal.org/node/2375235#comment-10205617
echo's user avatar
  • 36
2 votes
Accepted

Ajax not output to Ctools modal when using pager

The answer turned out to be a missing class in my pager links. Whenever you use CTools Modal, you have to add the ctools-use-modal class to the link. My first thought was to add the class as a link ...
wonder95's user avatar
  • 1,201
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
  • 82.7k
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,484
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

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
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,713
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
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

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

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
  • 97k
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.5k
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

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