Skip to content

Commit

Permalink
Issue #3308600 by perpignan: Error : Call to a member function getTot…
Browse files Browse the repository at this point in the history
…alItems() on null dans d_product_preprocess_page()
  • Loading branch information
grzegorz-pietrzak-droptica committed Sep 28, 2022
1 parent 06078eb commit 1094630
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ function d_commerce_products_list_preprocess_page(&$variables) {
$route_name = \Drupal::routeMatch()->getRouteName();
if (stripos($route_name, 'view.droopler_commerce_products_list') !== FALSE) {
$pager_manager = \Drupal::service('pager.manager');
$variables['pager_total_items'] = $pager_manager->getPager(0)->getTotalItems();
if ($pager = $pager_manager->getPager(0)) {
$variables['pager_total_items'] = $pager->getTotalItems();
}
$variables['#attached']['library'][] = 'd_commerce_products_list/d_commerce_products_list_select';
$variables['#attached']['library'][] = 'd_commerce_products_list/d_commerce_products_list_searches';

Expand Down
5 changes: 3 additions & 2 deletions modules/custom/d_product/d_product.module
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ function d_product_preprocess_page(&$variables) {
$route_name = \Drupal::routeMatch()->getRouteName();
if (stripos($route_name, 'view.products_list') !== FALSE) {
$pager_manager = \Drupal::service('pager.manager');
$variables['pager_total_items'] = $pager_manager->getPager(0)
->getTotalItems();
if ($pager = $pager_manager->getPager(0)) {
$variables['pager_total_items'] = $pager->getTotalItems();
}
$variables['#attached']['library'][] = 'd_product/d_product_select';
$variables['#attached']['library'][] = 'd_product/d_product_searches';
}
Expand Down

0 comments on commit 1094630

Please sign in to comment.