You are here

public function CdfVersionAttribute::onPopulateAttributes in Acquia Content Hub 8.2

Adds a version attribute to Cdf Objects.

Parameters

\Drupal\acquia_contenthub\Event\CdfAttributesEvent $event: The event being dispatched.

Throws

\Exception

File

src/EventSubscriber/CdfAttributes/CdfVersionAttribute.php, line 37

Class

CdfVersionAttribute
Notates the metadata with a CDF version marker.

Namespace

Drupal\acquia_contenthub\EventSubscriber\CdfAttributes

Code

public function onPopulateAttributes(CdfAttributesEvent $event) {
  $entity = $event
    ->getEntity();
  if ($entity instanceof TranslatableInterface) {
    $cdf = $event
      ->getCdf();
    $this
      ->setVersion($cdf);
  }
}