-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlugin.php
44 lines (35 loc) · 1008 Bytes
/
Plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace Analytics;
use MapasCulturais\App;
class Plugin extends \MapasCulturais\Plugin
{
public function __construct(array $config = [])
{
$config += [
"analytics_key" => env("ANALYTICS_KEY",""),
];
parent::__construct($config);
}
public function _init()
{
$app = App::i();
$self = $this;
// Analytics para o BaseV1
$app->hook("template(<<*>>.<<*>>.main-head):end", function () use ($self) {
$config = $self->config;
if($config['analytics_key']){
$this->part('analytics',["config" => $config]);
}
});
// Analytics para o BaseV2
$app->hook("template(<<*>>.<<*>>.head):end", function () use ($self) {
$config = $self->config;
if($config['analytics_key']){
$this->part('analytics',["config" => $config]);
}
});
}
public function register()
{
}
}