You are here

function moderation_dashboard_preprocess_views_view in Moderation Dashboard 8

Same name and namespace in other branches
  1. 2.0.x moderation_dashboard.module \moderation_dashboard_preprocess_views_view()

Implements hook_preprocess_views_view().

Don't show the pager if there's no reason to page. Might be fit for core.

File

./moderation_dashboard.module, line 49
Contains hooks for the moderation_dashboard module.

Code

function moderation_dashboard_preprocess_views_view(&$variables) {
  if (isset($variables['id']) && strpos($variables['id'], 'moderation_dashboard') === 0) {

    /** @var \Drupal\views\ViewExecutable $view */
    $view = $variables['view'];
    if ($view
      ->getCurrentPage() === 0 && $view->total_rows < $view
      ->getItemsPerPage()) {
      $variables['pager'] = [];
    }
  }
}