Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Check if ad_integration module exists, before trying to get the service #11

Open
wants to merge 2 commits into
base: 8.x-2.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion infinite_base.module
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ function infinite_base_get_all_parents($term) {
* Implements hook_preprocess_node().
*/
function infinite_base_preprocess_node(&$variables) {
if ($variables['view_mode'] == 'full' || $variables['view_mode'] == 'lazyloading') {
if ( ($variables['view_mode'] == 'full' || $variables['view_mode'] == 'lazyloading') && \Drupal::moduleHandler()->moduleExists('ad_integration')) {
/* @var \Drupal\ad_integration\AdIntegration $advertisingService */
$advertisingService = \Drupal::service('ad_integration');
if (is_object($advertisingService)) {
Expand Down