You are here

class SerializeAdditionalMetadataEvent in Acquia Content Hub 8.2

The event dispatched to serialize additional metadata for a Content Entity.

This event allows to attach additional metadata for a content entity which is not handled by fields. E.g. Webform Elements.

Hierarchy

Expanded class hierarchy of SerializeAdditionalMetadataEvent

2 files declare their use of SerializeAdditionalMetadataEvent
ContentEntityHandler.php in src/EventSubscriber/Cdf/ContentEntityHandler.php
WebformSubmissionHandler.php in src/EventSubscriber/Cdf/WebformSubmissionHandler.php

File

src/Event/SerializeAdditionalMetadataEvent.php, line 15

Namespace

Drupal\acquia_contenthub\Event
View source
class SerializeAdditionalMetadataEvent extends Event {

  /**
   * The entity being serialized.
   *
   * @var \Drupal\Core\Entity\ContentEntityInterface
   */
  protected $entity;

  /**
   * The CDF Object generated for this entity.
   *
   * @var \Acquia\ContentHubClient\CDF\CDFObject
   */
  protected $cdf;

  /**
   * CreateCdfEntityEvent constructor.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface $entity
   *   The entity being serialized.
   * @param \Acquia\ContentHubClient\CDF\CDFObject $cdf
   *   The CDF object generated for this entity.
   */
  public function __construct(ContentEntityInterface $entity, CDFObject $cdf) {
    $this->entity = $entity;
    $this->cdf = $cdf;
  }

  /**
   * Returns content entity event holds.
   *
   * @return \Drupal\Core\Entity\ContentEntityInterface
   *   Current entity event holds.
   */
  public function getEntity() : ContentEntityInterface {
    return $this->entity;
  }

  /**
   * Get the current CDF object event holds.
   *
   * @return \Acquia\ContentHubClient\CDF\CDFObject
   *   The CDF object.
   */
  public function getCdf() : CDFObject {
    return $this->cdf;
  }

  /**
   * Set the CDF object event holds.
   *
   * @param \Acquia\ContentHubClient\CDF\CDFObject $cdf
   *   The CDF Object.
   */
  public function setCdf(CDFObject $cdf) {
    $this->cdf = $cdf;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SerializeAdditionalMetadataEvent::$cdf protected property The CDF Object generated for this entity.
SerializeAdditionalMetadataEvent::$entity protected property The entity being serialized.
SerializeAdditionalMetadataEvent::getCdf public function Get the current CDF object event holds.
SerializeAdditionalMetadataEvent::getEntity public function Returns content entity event holds.
SerializeAdditionalMetadataEvent::setCdf public function Set the CDF object event holds.
SerializeAdditionalMetadataEvent::__construct public function CreateCdfEntityEvent constructor.