ServiceDataTrait.php in Analytics 8
Namespace
Drupal\analytics\PluginFile
src/Plugin/ServiceDataTrait.phpView source
<?php
namespace Drupal\analytics\Plugin;
trait ServiceDataTrait {
/**
* @return array
*/
public abstract function defaultData();
/**
* @return array
*/
public function getData() {
$data = $this
->defaultData();
$types = [
'analytics_' . $this
->getPluginId() . '_data',
'analytics_' . $this
->getServiceId() . '_data',
];
$this
->moduleHandler()
->alter($types, $data, $this);
return $data;
}
/**
* Wraps the module handler.
*
* @return \Drupal\Core\Extension\ModuleHandlerInterface
* The module handler.
*/
protected abstract function moduleHandler();
}
Traits
Name | Description |
---|---|
ServiceDataTrait |