Loading modules/cookies_facebook_pixel/cookies_facebook_pixel.module +19 −1 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Template\Attribute; use Drupal\cookies\CookiesKnockOutService; use Drupal\Core\Asset\AttachedAssetsInterface; /** * Implements hook_help(). Loading Loading @@ -44,10 +45,27 @@ function cookies_facebook_pixel_page_attachments(&$page) { ['type' => 'application/json', 'id' => "cookies_{$script}"] ); $page["#attached"]["html_head"][$key][0]['#attributes'] = new Attribute($attr); $page["#attached"]["library"][] = 'cookies_facebook_pixel/facebook_pixel'; break; } } } $page["#attached"]["library"][] = 'cookies_facebook_pixel/facebook_pixel'; } } /** * Implements hook_js_alter(). */ function cookies_facebook_pixel_js_alter(array &$javascript, AttachedAssetsInterface $assets) { $doKo = CookiesKnockOutService::getInstance()->doKnockOut(); if ($doKo) { $script = 'modules/contrib/facebook_pixel/js/facebook_pixel.js'; if (isset($javascript[$script])) { $javascript[$script]['preprocess'] = false; $javascript[$script]['attributes']['type'] = 'application/json'; $javascript[$script]['attributes']['id'] = 'facebook_tracking_pixel_script'; } } } modules/cookies_facebook_pixel/js/cookies_facebook_pixel.js +2 −1 Original line number Diff line number Diff line Loading @@ -12,7 +12,8 @@ activate: function () { var scriptIds = [ 'cookies_facebook_tracking_pixel_script' 'cookies_facebook_tracking_pixel_script', 'facebook_tracking_pixel_script' ]; for (var i in scriptIds) { var script = document.getElementById(scriptIds[i]); Loading Loading
modules/cookies_facebook_pixel/cookies_facebook_pixel.module +19 −1 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Template\Attribute; use Drupal\cookies\CookiesKnockOutService; use Drupal\Core\Asset\AttachedAssetsInterface; /** * Implements hook_help(). Loading Loading @@ -44,10 +45,27 @@ function cookies_facebook_pixel_page_attachments(&$page) { ['type' => 'application/json', 'id' => "cookies_{$script}"] ); $page["#attached"]["html_head"][$key][0]['#attributes'] = new Attribute($attr); $page["#attached"]["library"][] = 'cookies_facebook_pixel/facebook_pixel'; break; } } } $page["#attached"]["library"][] = 'cookies_facebook_pixel/facebook_pixel'; } } /** * Implements hook_js_alter(). */ function cookies_facebook_pixel_js_alter(array &$javascript, AttachedAssetsInterface $assets) { $doKo = CookiesKnockOutService::getInstance()->doKnockOut(); if ($doKo) { $script = 'modules/contrib/facebook_pixel/js/facebook_pixel.js'; if (isset($javascript[$script])) { $javascript[$script]['preprocess'] = false; $javascript[$script]['attributes']['type'] = 'application/json'; $javascript[$script]['attributes']['id'] = 'facebook_tracking_pixel_script'; } } }
modules/cookies_facebook_pixel/js/cookies_facebook_pixel.js +2 −1 Original line number Diff line number Diff line Loading @@ -12,7 +12,8 @@ activate: function () { var scriptIds = [ 'cookies_facebook_tracking_pixel_script' 'cookies_facebook_tracking_pixel_script', 'facebook_tracking_pixel_script' ]; for (var i in scriptIds) { var script = document.getElementById(scriptIds[i]); Loading