You are here

trait ServiceDataTrait in Analytics 8

Hierarchy

1 file declares its use of ServiceDataTrait
GoogleTagManager.php in src/Plugin/AnalyticsService/GoogleTagManager.php

File

src/Plugin/ServiceDataTrait.php, line 5

Namespace

Drupal\analytics\Plugin
View source
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();

}

Members

Namesort descending Modifiers Type Description Overrides
ServiceDataTrait::defaultData abstract public function 1
ServiceDataTrait::getData public function
ServiceDataTrait::moduleHandler abstract protected function Wraps the module handler.