You are here

class ContentHubPublishEntitiesEvent in Acquia Content Hub 8.2

Event fired for publishing of entities.

Hierarchy

Expanded class hierarchy of ContentHubPublishEntitiesEvent

See also

\Drupal\acquia_contenthub_publisher\ContentHubPublisherEvents

2 files declare their use of ContentHubPublishEntitiesEvent
ContentHubCommonActions.php in src/ContentHubCommonActions.php
RemoveUnmodifiedEntities.php in modules/acquia_contenthub_publisher/src/EventSubscriber/PublishEntities/RemoveUnmodifiedEntities.php

File

src/Event/ContentHubPublishEntitiesEvent.php, line 13

Namespace

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

  /**
   * The key eneity uuid from which this set of entities was calculated.
   *
   * @var string
   */
  protected $keyEntityUuid;

  /**
   * The dependency wrappers.
   *
   * @var \Drupal\depcalc\DependentEntityWrapperInterface[]
   */
  protected $dependencies;

  /**
   * ContentHubPublishEntitiesEvent constructor.
   *
   * @param string $key_entity_uuid
   *   The key entity that this set of entities was calculated from.
   * @param \Drupal\depcalc\DependentEntityWrapperInterface[] $dependencies
   *   The dependency wrappers.
   */
  public function __construct($key_entity_uuid, DependentEntityWrapperInterface ...$dependencies) {

    //@codingStandardsIgnoreLine
    $this->keyEntityUuid = $key_entity_uuid;
    foreach ($dependencies as $dependency) {
      $this->dependencies[$dependency
        ->getUuid()] = $dependency;
    }
  }

  /**
   * Get the dependencies.
   *
   * @return \Drupal\depcalc\DependentEntityWrapperInterface[]
   *   The dependencies.
   */
  public function getDependencies() {
    return $this->dependencies;
  }

  /**
   * Remove a specific dependency.
   *
   * @param string $uuid
   *   The uuid of the dependency to remove.
   */
  public function removeDependency($uuid) {

    // Don't allow the key entity to be removed.
    if ($uuid != $this->keyEntityUuid) {
      unset($this->dependencies[$uuid]);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ContentHubPublishEntitiesEvent::$dependencies protected property The dependency wrappers.
ContentHubPublishEntitiesEvent::$keyEntityUuid protected property The key eneity uuid from which this set of entities was calculated.
ContentHubPublishEntitiesEvent::getDependencies public function Get the dependencies.
ContentHubPublishEntitiesEvent::removeDependency public function Remove a specific dependency.
ContentHubPublishEntitiesEvent::__construct public function ContentHubPublishEntitiesEvent constructor.