class PublisherSubscriberStatusCdfAttribute in Acquia Content Hub 8.2
Extracts user specific data for identifying duplicate and anonymous users.
Hierarchy
- class \Drupal\acquia_contenthub\EventSubscriber\CdfAttributes\PublisherSubscriberStatusCdfAttribute implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of PublisherSubscriberStatusCdfAttribute
1 file declares its use of PublisherSubscriberStatusCdfAttribute
- PublisherSubscriberStatusCdfAttributeTest.php in tests/
src/ Unit/ EventSubscriber/ CdfAttributes/ PublisherSubscriberStatusCdfAttributeTest.php
1 string reference to 'PublisherSubscriberStatusCdfAttribute'
1 service uses PublisherSubscriberStatusCdfAttribute
File
- src/
EventSubscriber/ CdfAttributes/ PublisherSubscriberStatusCdfAttribute.php, line 14
Namespace
Drupal\acquia_contenthub\EventSubscriber\CdfAttributesView source
class PublisherSubscriberStatusCdfAttribute implements EventSubscriberInterface {
/**
* Status Checker.
*
* @var \Drupal\acquia_contenthub\PubSubModuleStatusChecker
*/
private $checker;
/**
* Constructor.
*
* @param \Drupal\acquia_contenthub\PubSubModuleStatusChecker $checker
* Status Checker.
*/
public function __construct(PubSubModuleStatusChecker $checker) {
$this->checker = $checker;
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events[AcquiaContentHubEvents::BUILD_CLIENT_CDF][] = [
'onBuildClientCdf',
100,
];
return $events;
}
/**
* Method called on the BUILD_CLIENT_CDF event.
*
* Adds publisher/subscriber status to the cdf.
*
* @param \Drupal\acquia_contenthub\Event\BuildClientCdfEvent $event
* The BuildClientCdfEvent object.
*
* @throws \Exception
*/
public function onBuildClientCdf(BuildClientCdfEvent $event) {
$cdf = $event
->getCdf();
$cdf
->addAttribute('publisher', CDFAttribute::TYPE_BOOLEAN, $this->checker
->isPublisher());
$cdf
->addAttribute('subscriber', CDFAttribute::TYPE_BOOLEAN, $this->checker
->isSubscriber());
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PublisherSubscriberStatusCdfAttribute:: |
private | property | Status Checker. | |
PublisherSubscriberStatusCdfAttribute:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
PublisherSubscriberStatusCdfAttribute:: |
public | function | Method called on the BUILD_CLIENT_CDF event. | |
PublisherSubscriberStatusCdfAttribute:: |
public | function | Constructor. |