class Generic in Googalytics - Google Analytics 8
Class FieldsObject.
Hierarchy
- class \Drupal\ga\AnalyticsCommand\Generic implements DrupalSettingCommandsInterface uses DrupalSettingCommandsTrait
Expanded class hierarchy of Generic
2 files declare their use of Generic
- AutoLink.php in src/
AnalyticsCommand/ Linker/ AutoLink.php - GenericTest.php in tests/
src/ Unit/ AnalyticsCommand/ GenericTest.php
File
- src/
AnalyticsCommand/ Generic.php, line 8
Namespace
Drupal\ga\AnalyticsCommandView source
class Generic implements DrupalSettingCommandsInterface {
use DrupalSettingCommandsTrait;
const DEFAULT_PRIORITY = 0;
/**
* The command name.
*
* @var string
*/
protected $command;
/**
* A map of values for the command's fieldsObject parameter.
*
* @var array
*/
protected $fieldsObject;
/**
* The name of the tracker for this command.
*
* @var string
*/
protected $trackerName;
/**
* AnalyticsCommand constructor.
*
* @param string $command
* The command name.
* @param array $fields_object
* A map of values for the command's fieldsObject parameter.
* @param string $tracker_name
* The tracker name (optional).
* @param int $priority
* The command priority.
*/
public function __construct($command, array $fields_object = [], $tracker_name = NULL, $priority = self::DEFAULT_PRIORITY) {
$this->command = $command;
$this->fieldsObject = $fields_object;
$this->trackerName = $tracker_name;
$this->priority = $priority;
}
/**
* Get the command name.
*
* @return string
* The command name.
*/
public function getCommand() {
return $this->command;
}
/**
* Get the map of values for the command's fieldsObject parameter.
*
* @return array
* An array of command values.
*/
public function getFieldsObject() {
return $this->fieldsObject;
}
/**
* The tracker this command will be applied to, if specified.
*
* @return null|string
* The tracker name, or NULL if the default tracker.
*/
public function getTrackerName() {
return $this->trackerName;
}
/**
* {@inheritdoc}
*/
public function getSettingCommands() {
$command = [
($this->trackerName ? $this->trackerName . '.' : '') . $this->command,
];
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:: |
constant | 4 | ||
Generic:: |
public | function | Get the command name. | |
Generic:: |
public | function | Get the map of values for the command's fieldsObject parameter. | |
Generic:: |
public | function |
An array of commands to be sent to Google Analytics. Overrides DrupalSettingCommandsTrait:: |
5 |
Generic:: |
public | function | The tracker this command will be applied to, if specified. | |
Generic:: |
public | function | AnalyticsCommand constructor. | 5 |