You are here

class ConfigDataEvent in Acquia Content Hub 8.2

Event for configuration data.

Hierarchy

  • class \Drupal\acquia_contenthub\Event\ConfigDataEvent extends \Symfony\Component\EventDispatcher\Event

Expanded class hierarchy of ConfigDataEvent

3 files declare their use of ConfigDataEvent
ConfigEntityHandler.php in src/EventSubscriber/Cdf/ConfigEntityHandler.php
DefaultConfigSerializer.php in src/EventSubscriber/SerializeConfig/DefaultConfigSerializer.php
EntityViewDisplaySerializer.php in src/EventSubscriber/SerializeConfig/EntityViewDisplaySerializer.php

File

src/Event/ConfigDataEvent.php, line 11

Namespace

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

  /**
   * The data array that will be serialized for export.
   *
   * @var array
   */
  protected $data = [];

  /**
   * The config entity whose data is being serialized.
   *
   * @var \Drupal\Core\Config\Entity\ConfigEntityInterface
   */
  protected $entity;

  /**
   * ConfigDataEvent constructor.
   *
   * @param \Drupal\Core\Config\Entity\ConfigEntityInterface $entity
   *   The config entity being serialized.
   */
  public function __construct(ConfigEntityInterface $entity) {
    $this->entity = $entity;
  }

  /**
   * The current data for the config entity.
   *
   * @return array
   *   Data for this configuration.
   */
  public function getData() : array {
    return $this->data;
  }

  /**
   * The entity being serialized.
   *
   * @return \Drupal\Core\Config\Entity\ConfigEntityInterface
   *   The configuration entity.
   */
  public function getEntity() : ConfigEntityInterface {
    return $this->entity;
  }

  /**
   * Set the data for serializing the entity.
   *
   * Event subscribers to this event should be mindful to use the
   * NestedArray::mergeDeepArray() method to merge data together and not
   * overwrite other event subscriber's data.
   *
   * @param array $data
   *   Data to set.
   */
  public function setData(array $data) : void {
    $this->data = $data;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigDataEvent::$data protected property The data array that will be serialized for export.
ConfigDataEvent::$entity protected property The config entity whose data is being serialized.
ConfigDataEvent::getData public function The current data for the config entity.
ConfigDataEvent::getEntity public function The entity being serialized.
ConfigDataEvent::setData public function Set the data for serializing the entity.
ConfigDataEvent::__construct public function ConfigDataEvent constructor.