class Set in Googalytics - Google Analytics 8
Class Set.
Hierarchy
- class \Drupal\ga\AnalyticsCommand\Generic implements DrupalSettingCommandsInterface uses DrupalSettingCommandsTrait
- class \Drupal\ga\AnalyticsCommand\Set
Expanded class hierarchy of Set
2 files declare their use of Set
- DefaultCommandSubscriber.php in src/
EventSubscriber/ DefaultCommandSubscriber.php - SetTest.php in tests/
src/ Unit/ AnalyticsCommand/ SetTest.php
File
- src/
AnalyticsCommand/ Set.php, line 8
Namespace
Drupal\ga\AnalyticsCommandView source
class Set extends Generic {
const DEFAULT_PRIORITY = 100;
/**
* The setting key.
*
* @var string
*/
protected $settingKey;
/**
* The setting value.
*
* @var mixed
*/
protected $settingValue;
/**
* Create constructor.
*
* @param string $setting_key
* The setting key.
* @param mixed $value
* The setting value.
* @param array $fields_object
* A set of additional options for the command.
* @param string $tracker_name
* The tracker name.
* @param int $priority
* The command priority.
*/
public function __construct($setting_key, $value, array $fields_object = [], $tracker_name = NULL, $priority = self::DEFAULT_PRIORITY) {
parent::__construct('set', $fields_object, $tracker_name, $priority);
$this->settingKey = $setting_key;
$this->settingValue = $value;
}
/**
* Get the setting key.
*
* @return string
* The setting key.
*/
public function getSettingKey() {
return $this->settingKey;
}
/**
* Get the setting value.
*
* @return mixed
* The setting value.
*/
public function getSettingValue() {
return $this->settingValue;
}
/**
* {@inheritdoc}
*/
public function getSettingCommands() {
$command = [
($this->trackerName ? $this->trackerName . '.' : '') . $this->command,
$this->settingKey,
$this->settingValue,
];
if (!empty($this->fieldsObject)) {
$command[] = $this->fieldsObject;
}
return [
$command,
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DrupalSettingCommandsTrait:: |
protected | property | Priority integer. | |
DrupalSettingCommandsTrait:: |
public | function | An integer value for sorting by priority. | |
Generic:: |
protected | property | The command name. | |
Generic:: |
protected | property | A map of values for the command's fieldsObject parameter. | |
Generic:: |
protected | property | The name of the tracker for this command. | |
Generic:: |
public | function | Get the command name. | |
Generic:: |
public | function | Get the map of values for the command's fieldsObject parameter. | |
Generic:: |
public | function | The tracker this command will be applied to, if specified. | |
Set:: |
protected | property | The setting key. | |
Set:: |
protected | property | The setting value. | |
Set:: |
constant |
Overrides Generic:: |
||
Set:: |
public | function |
An array of commands to be sent to Google Analytics. Overrides Generic:: |
|
Set:: |
public | function | Get the setting key. | |
Set:: |
public | function | Get the setting value. | |
Set:: |
public | function |
Create constructor. Overrides Generic:: |
2 |