GoogleAnalyticsPlugin::configMapping()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 30

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 30
rs 9.44
c 0
b 0
f 0
1
<?php
2
3
class GoogleAnalyticsPlugin extends \RainLoop\Plugins\AbstractPlugin
4
{
5
	/**
6
	 * @return void
7
	 */
8
	public function Init()
9
	{
10
		if ('' !== $this->Config()->Get('plugin', 'account', ''))
11
		{
12
			$this->addJs('js/include.js');
13
		}
14
	}
15
	
16
	/**
17
	 * @return array
18
	 */
19
	public function configMapping()
20
	{
21
		$oAccount = \RainLoop\Plugins\Property::NewInstance('account')->SetLabel('Account')
22
			->SetAllowedInJs(true)
23
			->SetDefaultValue('')
24
		;
25
26
		if (\method_exists($oAccount, 'SetPlaceholder'))
27
		{
28
			$oAccount->SetPlaceholder('UA-XXXXXXXX-X');
29
		}
30
		
31
		return array($oAccount,
32
			\RainLoop\Plugins\Property::NewInstance('domain_name')->SetLabel('Domain Name')
33
				->SetAllowedInJs(true)
34
				->SetDefaultValue(''),
35
			\RainLoop\Plugins\Property::NewInstance('universal_analytics')->SetLabel('Use Universal Analytics')
36
				->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL)
37
				->SetAllowedInJs(true)
38
				->SetDefaultValue(true),
39
			\RainLoop\Plugins\Property::NewInstance('track_pageview')->SetLabel('Track Pageview')
40
				->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL)
41
				->SetAllowedInJs(true)
42
				->SetDefaultValue(true),
43
			\RainLoop\Plugins\Property::NewInstance('send_events')->SetLabel('Send Events')
44
				->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL)
45
				->SetAllowedInJs(true)
46
				->SetDefaultValue(false)
47
		);
48
	}
49
}
50