Source of file GoogleAPISiteConfigExtension.php
Size: 1,015 Bytes - Last Modified: 2021-12-24T06:47:25+00:00
/var/www/docs.ssmods.com/process/src/code/Extensions/GoogleAPISiteConfigExtension.php
12345678910111213141516171819202122232425262728293031323334353637383940 | <?php /** * Class GoogleAPISiteConfigExtension * * @property SiteConfig|GoogleAPISiteConfigExtension $owner * @property string $Viewid * @property string $DateRange * @property string $Metric */ class GoogleAPISiteConfigExtension extends DataExtension { private static $db = [ 'Viewid' => 'Varchar(50)', 'DateRange' => 'Enum("7,30,60,90")', 'Metric' => 'Enum("ga:pageviews")' ]; protected static $date_range = [ 7 => '7 Days', 30 => '30 Days', 60 => '60 Days', 90 => '90 Days' ]; protected static $metrics = [ 'ga:pageviews' => 'Pageviews', ]; public function updateCMSFields(FieldList $fields) { $fields->addFieldsToTab('Root.GoogleAPI', [ TextField::create('Viewid', 'View ID from Analytics'), DropdownField::create('DateRange', 'Amount of days to get', static::$date_range), DropdownField::create('Metric', 'Metrics', static::$metrics) ]); } } |