public function ServicePluginBase::hasMultipleInstances in Analytics 8
File
- src/
Plugin/ ServicePluginBase.php, line 74
Class
- ServicePluginBase
- Defines a base implementation for analytics service plugins will extend.
Namespace
Drupal\analytics\PluginCode
public function hasMultipleInstances() {
if (!isset($this->hasMultiple)) {
$services = \Drupal::service('entity_type.manager')
->getStorage('analytics_service')
->loadMultiple();
$count = 0;
foreach ($services as $service) {
if ($service->service == $this
->getPluginId()) {
$count++;
}
}
$this->hasMultiple = $count >= 2;
}
return $this->hasMultiple;
}