Skip to content

ServiceDataTrait

Provides alterable data for analytics service plugins.


  • Full name: \Drupal\analytics\Plugin\ServiceDataTrait

Methods

defaultData

Gets the service's default data, before it's altered.

public defaultData(): array
  • This method is abstract. Return Value:

The default data.


getData

Gets the service's data, altered by other modules.

public getData(\Drupal\Core\Cache\RefinableCacheableDependencyInterface|null $cacheability = null): array

Invokes hook_analytics_SERVICE_ID_data_alter(), and also hook_analytics_PLUGIN_ID_data_alter() when the plugin ID differs.

Parameters:

Parameter Type Description
$cacheability \Drupal\Core\Cache\RefinableCacheableDependencyInterface|null
(optional) Collects the cacheability the alter hooks add, for the caller
to apply to the output.

Return Value:

The altered data.


moduleHandler

Wraps the module handler.

protected moduleHandler(): \Drupal\Core\Extension\ModuleHandlerInterface
  • This method is abstract. Return Value:

The module handler.