| Conditions | 2 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | public function includeBeacon() |
||
| 36 | { |
||
| 37 | $view = Craft::$app->getView(); |
||
| 38 | // Asset bundle |
||
| 39 | try { |
||
| 40 | $view->registerAssetBundle(BoomerangAsset::class); |
||
| 41 | } catch (InvalidConfigException $e) { |
||
| 42 | Craft::error($e->getMessage(), __METHOD__); |
||
| 43 | } |
||
| 44 | $boomerangUrl = Craft::$app->assetManager->getPublishedUrl( |
||
| 45 | '@nystudio107/webperf/assetbundles/boomerang/dist/js/boomerang-1.0.0.min.js', |
||
| 46 | true |
||
| 47 | ); |
||
| 48 | $script = PluginTemplate::renderPluginTemplate( |
||
| 49 | '_frontend/scripts/load-boomerang-iframe.twig', |
||
| 50 | [ |
||
| 51 | 'boomerangScriptUrl' => $boomerangUrl, |
||
| 52 | ] |
||
| 53 | ); |
||
| 54 | $view->registerJs( |
||
| 55 | $script, |
||
| 56 | $view::POS_HEAD |
||
| 57 | ); |
||
| 60 |