class Container in GoogleTagManager 8
Defines the container configuration entity.
@ConfigEntityType( id = "google_tag_container", label = @Translation("Container"), label_singular = @Translation("container"), label_plural = @Translation("containers"), label_collection = @Translation("Containers"), handlers = { "storage" = "Drupal\Core\Config\Entity\ConfigEntityStorage", "list_builder" = "Drupal\google_tag\ContainerListBuilder", "form" = { "default" = "Drupal\google_tag\Form\ContainerForm", "delete" = "Drupal\Core\Entity\EntityDeleteForm" }, "access" = "Drupal\google_tag\ContainerAccessControlHandler" }, admin_permission = "administer google tag manager", config_prefix = "container", entity_keys = { "id" = "id", "label" = "label", "status" = "status" }, config_export = { "id", "label", "weight", "container_id", "data_layer", "include_classes", "whitelist_classes", "blacklist_classes", "include_environment", "environment_id", "environment_token", "path_toggle", "path_list", "role_toggle", "role_list", "status_toggle", "status_list", "conditions", }, links = { "add-form" = "/admin/config/system/google-tag/add", "edit-form" = "/admin/config/system/google-tag/manage/{google_tag_container}", "delete-form" = "/admin/config/system/google-tag/manage/{google_tag_container}/delete", "enable" = "/admin/config/system/google-tag/manage/{google_tag_container}/enable", "disable" = "/admin/config/system/google-tag/manage/{google_tag_container}/disable", "collection" = "/admin/config/system/google-tag", } )
@todo Add a clone operation. this may not be an option in above annotation "clone-form" = "/admin/structure/google_tag/manage/{google_tag_container}/clone",
Hierarchy
- class \Drupal\Core\Entity\EntityBase implements EntityInterface uses RefinableCacheableDependencyTrait, DependencySerializationTrait
- class \Drupal\Core\Config\Entity\ConfigEntityBase implements ConfigEntityInterface uses SynchronizableEntityTrait, PluginDependencyTrait
- class \Drupal\google_tag\Entity\Container implements ConfigEntityInterface, EntityWithPluginCollectionInterface uses StringTranslationTrait
- class \Drupal\Core\Config\Entity\ConfigEntityBase implements ConfigEntityInterface uses SynchronizableEntityTrait, PluginDependencyTrait
Expanded class hierarchy of Container
3 files declare their use of Container
- ContainerController.php in src/
ContainerController.php - google_tag.api.php in ./
google_tag.api.php - Hooks provided by this module.
- GTMTestBase.php in tests/
src/ Functional/ GTMTestBase.php
File
- src/
Entity/ Container.php, line 71
Namespace
Drupal\google_tag\EntityView source
class Container extends ConfigEntityBase implements ConfigEntityInterface, EntityWithPluginCollectionInterface {
use StringTranslationTrait;
/**
* The machine name for the configuration entity.
*
* @var string
*/
protected $id;
/**
* The human-readable name of the configuration entity.
*
* @var string
*/
public $label;
/**
* The weight of the configuration entity.
*
* @var int
*/
public $weight = 0;
/**
* The Google Tag Manager container id.
*
* @var string
*/
public $container_id;
/**
* The name of the data layer.
*
* @var string
*/
public $data_layer;
/**
* Whether to add the listed classes to the data layer.
*
* @var bool
*/
public $include_classes;
/**
* The white-listed classes.
*
* @var string
*/
public $whitelist_classes;
/**
* The black-listed classes.
*
* @var string
*/
public $blacklist_classes;
/**
* Whether to include the environment items in the applicable snippets.
*
* @var bool
*/
public $include_environment;
/**
* The environment ID.
*
* @var string
*/
public $environment_id;
/**
* The environment token.
*
* @var string
*/
public $environment_token;
/**
* Whether to include or exclude the listed paths.
*
* @var string
*/
public $path_toggle;
/**
* The listed paths.
*
* @var string
*/
public $path_list;
/**
* Whether to include or exclude the listed roles.
*
* @var string
*/
public $role_toggle;
/**
* The listed roles.
*
* @var array
*/
public $role_list;
/**
* Whether to include or exclude the listed statuses.
*
* @var string
*/
public $status_toggle;
/**
* The listed statuses.
*
* @var string
*/
public $status_list;
/**
* The insertion conditions.
*
* Each item is the configuration array not the condition object.
*
* @var array
*/
protected $conditions = [];
/**
* The insertion condition collection.
*
* @var \Drupal\Core\Condition\ConditionPluginCollection
*/
protected $conditionCollection;
/**
* The condition plugin manager.
*
* @var \Drupal\Core\Executable\ExecutableManagerInterface
*/
protected $conditionPluginManager;
/**
* {@inheritdoc}
*/
public function __construct(array $values, $entity_type) {
parent::__construct($values, $entity_type);
$values = array_diff_key($values, array_flip([
'uuid',
'langcode',
]));
if (empty($values)) {
// Initialize entity properties from default container settings.
$config = \Drupal::config('google_tag.settings');
foreach ($config
->get('_default_container') as $key => $value) {
$this->{$key} = $value;
}
}
}
/**
* Returns array of JavaScript snippets.
*
* @return array
* Associative array of snippets keyed by type: script, noscript and
* data_layer.
*/
public function snippets() {
$snippets = [
'script' => $this
->scriptSnippet(),
'noscript' => $this
->noscriptSnippet(),
'data_layer' => $this
->dataLayerSnippet(),
];
// Allow other modules to alter the snippets.
\Drupal::moduleHandler()
->alter('google_tag_snippets', $snippets, $this);
return $snippets;
}
/**
* Returns JavaScript script snippet.
*
* @return array
* The script snippet.
*/
protected function scriptSnippet() {
// Gather data.
$container_id = $this
->variableClean('container_id');
$data_layer = $this
->variableClean('data_layer');
$query = $this
->environmentQuery();
// Build script snippet.
$script = <<<EOS
(function(w,d,s,l,i){
w[l]=w[l]||[];
w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});
var f=d.getElementsByTagName(s)[0];
var j=d.createElement(s);
var dl=l!='dataLayer'?'&l='+l:'';
j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl+'{<span class="php-variable">$query</span>}';
j.async=true;
f.parentNode.insertBefore(j,f);
})(window,document,'script','{<span class="php-variable">$data_layer</span>}','{<span class="php-variable">$container_id</span>}');
EOS;
return $this
->compactSnippet($script);
}
/**
* Returns JavaScript noscript snippet.
*
* @return array
* The noscript snippet.
*/
protected function noscriptSnippet() {
// Gather data.
$container_id = $this
->variableClean('container_id');
$query = $this
->environmentQuery();
// Build noscript snippet.
$noscript = <<<EOS
<noscript aria-hidden="true"><iframe src="https://www.googletagmanager.com/ns.html?id={<span class="php-variable">$container_id</span>}{<span class="php-variable">$query</span>}"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
EOS;
return $this
->compactSnippet($noscript, [
"\n",
]);
}
/**
* Returns JavaScript data layer snippet or adds items to data layer.
*
* @return string|null
* The data layer snippet or NULL.
*/
protected function dataLayerSnippet() {
// Gather data.
$data_layer = $this
->variableClean('data_layer');
$whitelist = $this
->get('whitelist_classes');
$blacklist = $this
->get('blacklist_classes');
$classes = [];
$names = [
'whitelist',
'blacklist',
];
foreach ($names as $name) {
if (empty(${$name})) {
continue;
}
// @see https://www.drupal.org/files/issues/add_options_to-2851405-7.patch
// this suggests to flip order of previous two statements; yet if user
// enters a new line in textarea, then this change does not eliminate the
// empty script item. Need to trim "\n" from ends of string.
${$name} = explode("\n", ${$name});
$classes["gtm.{$name}"] = ${$name};
}
if ($classes) {
// Build data layer snippet.
$classes = json_encode($classes);
$script = <<<EOS
(function(w,l){
w[l]=w[l]||[];
w[l].push({<span class="php-variable">$classes</span>});
})(window,'{<span class="php-variable">$data_layer</span>}');
EOS;
return $this
->compactSnippet($script);
}
}
/**
* Returns a query string with the environment parameters.
*
* @return string
* The query string.
*/
public function environmentQuery() {
if (!$this
->get('include_environment')) {
return '';
}
// Gather data.
$environment_id = $this
->variableClean('environment_id');
$environment_token = $this
->variableClean('environment_token');
// Build query string.
return ">m_auth={$environment_token}>m_preview={$environment_id}>m_cookies_win=x";
}
/**
* Returns a cleansed variable.
*
* @param string $variable
* The variable name.
*
* @return string
* The cleansed variable.
*/
public function variableClean($variable) {
return trim(json_encode($this
->get($variable)), '"');
}
/**
* Returns the compacted snippet.
*
* @param string $snippet
* The JavaScript snippet.
* @param array $search
* The array of strings to replace with blank.
*
* @return string
* The compacted snippet.
*/
protected function compactSnippet($snippet, array $search = [
"\n",
' ',
]) {
$compact = \Drupal::config('google_tag.settings')
->get('compact_snippet');
return $compact ? str_replace($search, '', $snippet) : $snippet;
}
/**
* Determines whether to insert the snippet on the response.
*
* @return bool
* TRUE if the conditions are met; FALSE otherwise.
*/
public function insertSnippet() {
static $satisfied = [];
if (!isset($satisfied[$this->id])) {
$id = $this
->get('container_id');
if (empty($id)) {
// No container ID.
return $satisfied[$this->id] = FALSE;
}
$this
->displayMessage('google_tag container ' . $this->id);
$satisfied[$this->id] = TRUE;
if (!$this
->statusCheck() || !$this
->pathCheck() || !$this
->roleCheck() || !$this
->access('view')) {
// Omit snippet if any condition is not met.
$satisfied[$this->id] = FALSE;
}
// Allow other modules to alter the insertion criteria.
\Drupal::moduleHandler()
->alter('google_tag_insert', $satisfied[$this->id], $this);
$this
->displayMessage('after alter @satisfied', [
'@satisfied' => $satisfied[$this->id],
]);
}
return $satisfied[$this->id];
}
/**
* Determines whether to insert the snippet based on status code settings.
*
* @return bool
* TRUE if the status conditions are met; FALSE otherwise.
*/
protected function statusCheck() {
$toggle = $this
->get('status_toggle');
$statuses = $this
->get('status_list');
if (empty($statuses)) {
$satisfied = $toggle == GOOGLE_TAG_EXCLUDE_LISTED;
}
else {
// Get the HTTP response status.
$request = \Drupal::request();
$status = '200';
if ($exception = $request->attributes
->get('exception')) {
$status = $exception
->getStatusCode();
}
$satisfied = strpos($statuses, (string) $status) !== FALSE;
$satisfied = $toggle == GOOGLE_TAG_EXCLUDE_LISTED ? !$satisfied : $satisfied;
}
$this
->displayMessage('status check @satisfied', [
'@satisfied' => $satisfied,
]);
return $satisfied;
}
/**
* Determines whether to insert the snippet based on the path settings.
*
* @return bool
* TRUE if the path conditions are met; FALSE otherwise.
*/
protected function pathCheck() {
$toggle = $this
->get('path_toggle');
$paths = mb_strtolower($this
->get('path_list'));
if (empty($paths)) {
$satisfied = $toggle == GOOGLE_TAG_EXCLUDE_LISTED;
}
else {
$request = \Drupal::request();
$current_path = \Drupal::service('path.current');
$alias_manager = \Drupal::service('path_alias.manager');
$path_matcher = \Drupal::service('path.matcher');
// @todo Are not some paths case sensitive???
// Compare the lowercase path alias (if any) and internal path.
$path = $current_path
->getPath($request);
$path_alias = mb_strtolower($alias_manager
->getAliasByPath($path));
$satisfied = $path_matcher
->matchPath($path_alias, $paths) || $path != $path_alias && $path_matcher
->matchPath($path, $paths);
$satisfied = $toggle == GOOGLE_TAG_EXCLUDE_LISTED ? !$satisfied : $satisfied;
}
$this
->displayMessage('path check @satisfied', [
'@satisfied' => $satisfied,
]);
return $satisfied;
}
/**
* Determines whether to insert the snippet based on the user role settings.
*
* @return bool
* TRUE if the role conditions are met; FALSE otherwise.
*/
protected function roleCheck() {
$toggle = $this
->get('role_toggle');
$roles = array_filter($this
->get('role_list'));
if (empty($roles)) {
$satisfied = $toggle == GOOGLE_TAG_EXCLUDE_LISTED;
}
else {
$satisfied = FALSE;
// Check user roles against listed roles.
$satisfied = (bool) array_intersect($roles, \Drupal::currentUser()
->getRoles());
$satisfied = $toggle == GOOGLE_TAG_EXCLUDE_LISTED ? !$satisfied : $satisfied;
}
$this
->displayMessage('role check @satisfied', [
'@satisfied' => $satisfied,
]);
return $satisfied;
}
/**
* Displays a message.
*
* @param string $message
* The message to display.
* @param array $args
* (optional) An associative array of replacements.
*/
public function displayMessage($message, array $args = []) {
if (\Drupal::config('google_tag.settings')
->get('debug_output')) {
\Drupal::service('messenger')
->addStatus($this
->t($message, $args), TRUE);
}
}
/**
* Returns the snippet directory path.
*
* @return string
* The snippet directory path.
*/
public function snippetDirectory() {
return \Drupal::config('google_tag.settings')
->get('uri') . "/google_tag/{$this->id()}";
}
/**
* Returns the snippet URI for a snippet type.
*
* @param string $type
* The snippet type.
*
* @return string
* The snippet URI.
*/
public function snippetURI($type) {
return $this
->snippetDirectory() . "/google_tag.{$type}.js";
}
/**
* Returns the snippet cache ID for a snippet type.
*
* @param string $type
* The snippet type.
*
* @return string
* The snippet cache ID.
*/
public function snippetCid($type) {
return "google_tag:{$type}:{$this->id()}";
}
/**
* Returns tag array for the snippet type.
*
* @param string $type
* The snippet type.
* @param int $weight
* The weight of the item.
*
* @return array
* The tag array.
*/
public function fileTag($type, $weight) {
$uri = $this
->snippetURI($type);
$url = file_url_transform_relative(file_create_url($uri));
$query_string = \Drupal::state()
->get('system.css_js_query_string') ?: '0';
$attachment = [
[
'#type' => 'html_tag',
'#tag' => 'script',
'#attributes' => [
'src' => $url . '?' . $query_string,
'defer' => TRUE,
],
'#weight' => $weight,
],
"google_tag_{$type}_tag__{$this->id()}",
];
return $attachment;
}
/**
* Returns tag array for the snippet type.
*
* @param string $type
* The snippet type.
* @param int $weight
* The weight of the item.
*
* @return array
* The tag array.
*/
public function inlineTag($type, $weight) {
$contents = $this
->getSnippetContents($type);
$attachment = [
$contents ? [
'#type' => 'html_tag',
'#tag' => 'script',
'#value' => new FormattableMarkup($contents, []),
'#weight' => $weight,
] : [
'#type' => 'ignore_tag',
],
"google_tag_{$type}_tag__{$this->id()}",
];
return $attachment;
}
/**
* Returns tag array for the snippet type.
*
* @param string $type
* (optional) The snippet type.
* @param int $weight
* (optional) The weight of the item.
*
* @return array
* The tag array.
*/
public function noscriptTag($type = 'noscript', $weight = -10) {
// Note: depending on the theme, this may not place the snippet immediately
// after the body tag but should be close and it can be altered.
// @see https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!theme.api.php/group/theme_render/8.2.x
// The markup is passed through \Drupal\Component\Utility\Xss::filterAdmin()
// which strips known vectors while allowing a permissive list of HTML tags
// that are not XSS vectors. (e.g., <script> and <style> are not allowed.)
// As markup, core removes the 'style' attribute from the noscript snippet.
// With the inline template type, core does not alter the noscript snippet.
$contents = $this
->getSnippetContents($type);
$attachment = $contents ? [
"google_tag_{$type}_tag__{$this->id()}" => [
'#type' => 'inline_template',
'#template' => $contents,
'#weight' => $weight,
],
] : [];
return $attachment;
}
/**
* Returns the snippet contents for the snippet type.
*
* @param string $type
* The snippet type.
*
* @return string
* The snippet contents.
*/
public function getSnippetContents($type) {
$cache = \Drupal::service('cache.data')
->get($this
->snippetCid($type));
return $cache ? $cache->data : '';
}
/**
* {@inheritdoc}
*/
public function getPluginCollections() {
return [
'conditions' => $this
->getInsertionConditions(),
];
}
/**
* Returns an array of configuration arrays keyed by insertion condition.
*
* @return array
* An array of condition configuration keyed by the condition ID.
*/
public function getInsertionConfiguration() {
return $this
->getInsertionConditions()
->getConfiguration();
}
/**
* Returns an insertion condition for this container.
*
* @param string $instance_id
* The condition plugin instance ID.
*
* @return \Drupal\Core\Condition\ConditionInterface
* A condition plugin.
*/
public function getInsertionCondition($instance_id) {
return $this
->getInsertionConditions()
->get($instance_id);
}
/**
* Sets the configuration for an insertion condition.
*
* @param string $instance_id
* The condition instance ID.
* @param array $configuration
* The condition configuration.
*
* @return $this
*
* @todo Does this need to set a persistent property?
*/
public function setInsertionCondition($instance_id, array $configuration) {
$conditions = $this
->getInsertionConditions();
if (!$conditions
->has($instance_id)) {
$configuration['id'] = $instance_id;
$conditions
->addInstanceId($instance_id, $configuration);
}
else {
$conditions
->setInstanceConfiguration($instance_id, $configuration);
}
return $this;
}
/**
* Returns the set of insertion conditions for this container.
*
* @return \Drupal\Core\Condition\ConditionPluginCollection
* A collection of configured condition plugins.
*/
public function getInsertionConditions() {
if (!isset($this->conditionCollection)) {
$this->conditionCollection = new ConditionPluginCollection($this
->conditionPluginManager(), $this
->get('conditions'));
}
return $this->conditionCollection;
}
/**
* Gets the condition plugin manager.
*
* @return \Drupal\Core\Executable\ExecutableManagerInterface
* The condition plugin manager.
*/
protected function conditionPluginManager() {
if (!isset($this->conditionPluginManager)) {
$this->conditionPluginManager = \Drupal::service('plugin.manager.condition');
}
return $this->conditionPluginManager;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CacheableDependencyTrait:: |
protected | property | Cache contexts. | |
CacheableDependencyTrait:: |
protected | property | Cache max-age. | |
CacheableDependencyTrait:: |
protected | property | Cache tags. | |
CacheableDependencyTrait:: |
protected | function | Sets cacheability; useful for value object constructors. | |
ConfigEntityBase:: |
private | property | Whether the config is being deleted by the uninstall process. | |
ConfigEntityBase:: |
protected | property | The language code of the entity's default language. | |
ConfigEntityBase:: |
protected | property | The original ID of the configuration entity. | |
ConfigEntityBase:: |
protected | property | The enabled/disabled status of the configuration entity. | 4 |
ConfigEntityBase:: |
protected | property | Third party entity settings. | |
ConfigEntityBase:: |
protected | property | Trust supplied data and not use configuration schema on save. | |
ConfigEntityBase:: |
protected | property | The UUID for this entity. | |
ConfigEntityBase:: |
protected | property | Information maintained by Drupal core about configuration. | |
ConfigEntityBase:: |
protected | function | Overrides \Drupal\Core\Entity\DependencyTrait:addDependency(). | |
ConfigEntityBase:: |
public | function |
Calculates dependencies and stores them in the dependency property. Overrides ConfigEntityInterface:: |
13 |
ConfigEntityBase:: |
public | function |
Creates a duplicate of the entity. Overrides EntityBase:: |
1 |
ConfigEntityBase:: |
public | function |
Disables the configuration entity. Overrides ConfigEntityInterface:: |
1 |
ConfigEntityBase:: |
public | function |
Enables the configuration entity. Overrides ConfigEntityInterface:: |
|
ConfigEntityBase:: |
public | function |
Returns the value of a property. Overrides ConfigEntityInterface:: |
|
ConfigEntityBase:: |
public | function |
Returns the cache tags that should be used to invalidate caches. Overrides EntityBase:: |
1 |
ConfigEntityBase:: |
public | function |
Gets the configuration dependency name. Overrides EntityBase:: |
|
ConfigEntityBase:: |
protected static | function | Gets the configuration manager. | |
ConfigEntityBase:: |
public | function |
Gets the configuration target identifier for the entity. Overrides EntityBase:: |
|
ConfigEntityBase:: |
public | function |
Gets the configuration dependencies. Overrides ConfigEntityInterface:: |
|
ConfigEntityBase:: |
public | function |
Gets the original ID. Overrides EntityBase:: |
|
ConfigEntityBase:: |
public | function |
Gets the list of third parties that store information. Overrides ThirdPartySettingsInterface:: |
|
ConfigEntityBase:: |
public | function |
Gets the value of a third-party setting. Overrides ThirdPartySettingsInterface:: |
|
ConfigEntityBase:: |
public | function |
Gets all third-party settings of a given module. Overrides ThirdPartySettingsInterface:: |
|
ConfigEntityBase:: |
protected | function | Gets the typed config manager. | |
ConfigEntityBase:: |
public | function |
Gets whether on not the data is trusted. Overrides ConfigEntityInterface:: |
|
ConfigEntityBase:: |
protected static | function |
Override to never invalidate the individual entities' cache tags; the
config system already invalidates them. Overrides EntityBase:: |
|
ConfigEntityBase:: |
protected | function |
Override to never invalidate the entity's cache tag; the config system
already invalidates it. Overrides EntityBase:: |
|
ConfigEntityBase:: |
public | function |
Checks whether this entity is installable. Overrides ConfigEntityInterface:: |
2 |
ConfigEntityBase:: |
public | function |
Overrides Entity::isNew(). Overrides EntityBase:: |
|
ConfigEntityBase:: |
public | function |
Returns whether this entity is being changed during the uninstall process. Overrides ConfigEntityInterface:: |
|
ConfigEntityBase:: |
public | function |
Deprecated way of generating a link to the entity. See toLink(). Overrides EntityBase:: |
|
ConfigEntityBase:: |
public | function |
Informs the entity that entities it depends on will be deleted. Overrides ConfigEntityInterface:: |
7 |
ConfigEntityBase:: |
public static | function |
Acts on entities before they are deleted and before hooks are invoked. Overrides EntityBase:: |
8 |
ConfigEntityBase:: |
public | function |
Acts on an entity before the presave hook is invoked. Overrides EntityBase:: |
13 |
ConfigEntityBase:: |
public | function |
Saves an entity permanently. Overrides EntityBase:: |
1 |
ConfigEntityBase:: |
public | function |
Sets the value of a property. Overrides ConfigEntityInterface:: |
|
ConfigEntityBase:: |
public | function |
Sets the original ID. Overrides EntityBase:: |
|
ConfigEntityBase:: |
public | function |
Sets the status of the configuration entity. Overrides ConfigEntityInterface:: |
|
ConfigEntityBase:: |
public | function |
Sets the value of a third-party setting. Overrides ThirdPartySettingsInterface:: |
|
ConfigEntityBase:: |
public | function | ||
ConfigEntityBase:: |
public static | function | Helper callback for uasort() to sort configuration entities by weight and label. | 6 |
ConfigEntityBase:: |
public | function |
Returns whether the configuration entity is enabled. Overrides ConfigEntityInterface:: |
4 |
ConfigEntityBase:: |
public | function |
Gets an array of all property values. Overrides EntityBase:: |
2 |
ConfigEntityBase:: |
public | function |
Gets the URL object for the entity. Overrides EntityBase:: |
|
ConfigEntityBase:: |
public | function |
Sets that the data should be trusted. Overrides ConfigEntityInterface:: |
|
ConfigEntityBase:: |
public | function |
Unsets a third-party setting. Overrides ThirdPartySettingsInterface:: |
|
ConfigEntityBase:: |
public | function |
Gets the public URL for this entity. Overrides EntityBase:: |
|
ConfigEntityBase:: |
public | function |
Gets the URL object for the entity. Overrides EntityBase:: |
|
ConfigEntityBase:: |
public | function |
Overrides EntityBase:: |
4 |
Container:: |
public | property | The black-listed classes. | |
Container:: |
protected | property | The insertion condition collection. | |
Container:: |
protected | property | The condition plugin manager. | |
Container:: |
protected | property | The insertion conditions. | |
Container:: |
public | property | The Google Tag Manager container id. | |
Container:: |
public | property | The name of the data layer. | |
Container:: |
public | property | The environment ID. | |
Container:: |
public | property | The environment token. | |
Container:: |
protected | property | The machine name for the configuration entity. | |
Container:: |
public | property | Whether to add the listed classes to the data layer. | |
Container:: |
public | property | Whether to include the environment items in the applicable snippets. | |
Container:: |
public | property | The human-readable name of the configuration entity. | |
Container:: |
public | property | The listed paths. | |
Container:: |
public | property | Whether to include or exclude the listed paths. | |
Container:: |
public | property | The listed roles. | |
Container:: |
public | property | Whether to include or exclude the listed roles. | |
Container:: |
public | property | The listed statuses. | |
Container:: |
public | property | Whether to include or exclude the listed statuses. | |
Container:: |
public | property | The weight of the configuration entity. | |
Container:: |
public | property | The white-listed classes. | |
Container:: |
protected | function | Returns the compacted snippet. | |
Container:: |
protected | function | Gets the condition plugin manager. | |
Container:: |
protected | function | Returns JavaScript data layer snippet or adds items to data layer. | |
Container:: |
public | function | Displays a message. | |
Container:: |
public | function | Returns a query string with the environment parameters. | |
Container:: |
public | function | Returns tag array for the snippet type. | |
Container:: |
public | function | Returns an insertion condition for this container. | |
Container:: |
public | function | Returns the set of insertion conditions for this container. | |
Container:: |
public | function | Returns an array of configuration arrays keyed by insertion condition. | |
Container:: |
public | function |
Gets the plugin collections used by this object. Overrides ObjectWithPluginCollectionInterface:: |
|
Container:: |
public | function | Returns the snippet contents for the snippet type. | |
Container:: |
public | function | Returns tag array for the snippet type. | |
Container:: |
public | function | Determines whether to insert the snippet on the response. | |
Container:: |
protected | function | Returns JavaScript noscript snippet. | |
Container:: |
public | function | Returns tag array for the snippet type. | |
Container:: |
protected | function | Determines whether to insert the snippet based on the path settings. | |
Container:: |
protected | function | Determines whether to insert the snippet based on the user role settings. | |
Container:: |
protected | function | Returns JavaScript script snippet. | |
Container:: |
public | function | Sets the configuration for an insertion condition. | |
Container:: |
public | function | Returns the snippet cache ID for a snippet type. | |
Container:: |
public | function | Returns the snippet directory path. | |
Container:: |
public | function | Returns array of JavaScript snippets. | |
Container:: |
public | function | Returns the snippet URI for a snippet type. | |
Container:: |
protected | function | Determines whether to insert the snippet based on status code settings. | |
Container:: |
public | function | Returns a cleansed variable. | |
Container:: |
public | function |
Constructs an Entity object. Overrides ConfigEntityBase:: |
|
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | Aliased as: traitSleep | 1 |
DependencySerializationTrait:: |
public | function | 2 | |
DependencyTrait:: |
protected | property | The object's dependencies. | |
DependencyTrait:: |
protected | function | Adds multiple dependencies. | |
DependencyTrait:: |
protected | function | Adds a dependency. Aliased as: addDependencyTrait | |
EntityBase:: |
protected | property | Boolean indicating whether the entity should be forced to be new. | |
EntityBase:: |
protected | property | The entity type. | |
EntityBase:: |
protected | property | A typed data object wrapping this entity. | |
EntityBase:: |
public | function |
Checks data value access. Overrides AccessibleInterface:: |
1 |
EntityBase:: |
public | function |
Gets the bundle of the entity. Overrides EntityInterface:: |
1 |
EntityBase:: |
public static | function |
Constructs a new entity object, without permanently saving it. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Deletes an entity permanently. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Enforces an entity to be new. Overrides EntityInterface:: |
|
EntityBase:: |
protected | function | Gets the entity manager. | |
EntityBase:: |
protected | function | Gets the entity type bundle info service. | |
EntityBase:: |
protected | function | Gets the entity type manager. | |
EntityBase:: |
public | function |
The cache contexts associated with this object. Overrides CacheableDependencyTrait:: |
|
EntityBase:: |
public | function |
The maximum age for which this object may be cached. Overrides CacheableDependencyTrait:: |
|
EntityBase:: |
public | function |
The cache tags associated with this object. Overrides CacheableDependencyTrait:: |
|
EntityBase:: |
public | function |
Gets the key that is used to store configuration dependencies. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the entity type definition. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the ID of the type of the entity. Overrides EntityInterface:: |
|
EntityBase:: |
protected | function | The list cache tags to invalidate for this entity. | |
EntityBase:: |
public | function |
Gets a typed data object for this entity object. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Indicates if a link template exists for a given key. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets the identifier. Overrides EntityInterface:: |
11 |
EntityBase:: |
public | function |
Gets the label of the entity. Overrides EntityInterface:: |
6 |
EntityBase:: |
public | function |
Gets the language of the entity. Overrides EntityInterface:: |
1 |
EntityBase:: |
protected | function | Gets the language manager. | |
EntityBase:: |
protected | function | Gets an array link templates. | 1 |
EntityBase:: |
public static | function |
Loads an entity. Overrides EntityInterface:: |
|
EntityBase:: |
public static | function |
Loads one or more entities. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Acts on a created entity before hooks are invoked. Overrides EntityInterface:: |
4 |
EntityBase:: |
public static | function |
Acts on deleted entities before the delete hook is invoked. Overrides EntityInterface:: |
16 |
EntityBase:: |
public static | function |
Acts on loaded entities. Overrides EntityInterface:: |
2 |
EntityBase:: |
public | function |
Acts on a saved entity before the insert or update hook is invoked. Overrides EntityInterface:: |
14 |
EntityBase:: |
public static | function |
Changes the values of an entity before it is created. Overrides EntityInterface:: |
5 |
EntityBase:: |
public | function |
Gets a list of entities referenced by this entity. Overrides EntityInterface:: |
1 |
EntityBase:: |
public | function |
Generates the HTML for a link to this entity. Overrides EntityInterface:: |
|
EntityBase:: |
public | function |
Gets a list of URI relationships supported by this entity. Overrides EntityInterface:: |
|
EntityBase:: |
protected | function | Gets an array of placeholders for this entity. | 2 |
EntityBase:: |
public | function |
Gets the entity UUID (Universally Unique Identifier). Overrides EntityInterface:: |
1 |
EntityBase:: |
protected | function | Gets the UUID generator. | |
PluginDependencyTrait:: |
protected | function | Calculates and adds dependencies of a specific plugin instance. | 1 |
PluginDependencyTrait:: |
protected | function | Calculates and returns dependencies of a specific plugin instance. | |
PluginDependencyTrait:: |
protected | function | Wraps the module handler. | 1 |
PluginDependencyTrait:: |
protected | function | Wraps the theme handler. | 1 |
RefinableCacheableDependencyTrait:: |
public | function | 1 | |
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
SynchronizableEntityTrait:: |
protected | property | Whether this entity is being created, updated or deleted through a synchronization process. | |
SynchronizableEntityTrait:: |
public | function | ||
SynchronizableEntityTrait:: |
public | function |