0

It is possible to pass and argument to a view for the limit on its pager? I see that there is this question for Drupal 7, but not Drupal 8.

0

Try this out :

use Drupal\views\ViewExecutable;

/**
 * Implements hook_views_pre_build().
 */
function customModule_views_pre_build(ViewExecutable $view) {
  if ($view->id() == 'your_view_id') {
   //- Set the new limit here // 3
   $view->setItemsPerPage(3);
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.