Commit bf733409 authored by Avris's avatar Avris

v4.0

parent e813d911
Avris\Micrus\GoogleAnalytics\GoogleAnalytics:
arguments: ['@config.parameters.?googleAnalytics']
Avris\Micrus\GoogleAnalytics\:
dir: '%MODULE_DIR%/src/'
<?php
namespace Avris\Micrus\GoogleAnalytics;
use Avris\Bag\Bag;
use Avris\Micrus\Bootstrap\EventSubscriberInterface;
use Avris\Micrus\Controller\Http\RequestInterface;
use Avris\Micrus\Tool\Config\ParametersProvider;
class GoogleAnalytics extends \Twig_Extension implements EventSubscriberInterface
{
......@@ -28,15 +26,15 @@ HTML;
/** @var string[] */
private $queue = [];
public function __construct(Bag $config)
public function __construct(string $envGaTrackingId)
{
$this->trackingId = $config->get('trackingId');
$this->trackingId = $envGaTrackingId;
}
public function getFunctions()
{
return [
'googleAnaytics' => new \Twig_SimpleFunction('googleAnaytics', function () {
new \Twig_SimpleFunction('googleAnaytics', function () {
return $this->trackingId ? sprintf(static::CODE, $this->trackingId) : '';
}, ['is_safe' => ['html']]),
];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment