You are here

class MultiversionManagerEvent in Multiversion 8

MultiversionManagerEvent class.

Subscribers of this event can add additional logic for specific content type on pre/post import on including/excluding content type to multiversionable. As examples:

  • Rebuild menu_tree table on a menu_link_content migration.
  • Rebuild node_grants table permissions.

Hierarchy

Expanded class hierarchy of MultiversionManagerEvent

4 files declare their use of MultiversionManagerEvent
FileUsageMigrateSubscriber.php in src/EventSubscriber/FileUsageMigrateSubscriber.php
MenuLinkContentMigrateSubscriber.php in src/EventSubscriber/MenuLinkContentMigrateSubscriber.php
MultiversionManager.php in src/MultiversionManager.php
PathAutoAliasSubscriber.php in src/EventSubscriber/PathAutoAliasSubscriber.php

File

src/Event/MultiversionManagerEvent.php, line 17

Namespace

Drupal\multiversion\Event
View source
class MultiversionManagerEvent extends Event {

  /**
   * List of entity types keyed with their entity id.
   *
   * @var \Drupal\Core\Entity\ContentEntityTypeInterface[]
   */
  protected $entityTypes;

  /**
   * Operation type name.
   *
   * @var string
   */
  protected $op;

  /**
   * Constructor.
   *
   * @param \Drupal\Core\Entity\ContentEntityTypeInterface[] $entity_types
   * @param $op
   */
  public function __construct(array $entity_types, $op) {
    $this->entityTypes = $entity_types;
    $this->op = $op;
  }

  /**
   * Get the operation type value.
   *
   * @return string
   */
  public function getOp() {
    return $this->op;
  }

  /**
   * Get the list of entity types.
   *
   * @return \Drupal\Core\Entity\ContentEntityTypeInterface[]
   */
  public function getEntityTypes() {
    return $this->entityTypes;
  }

  /**
   * It helps the event subscriber to validate the entity_type_id value.
   *
   * @param string $entity_type_id
   *
   * @return \Drupal\Core\Entity\ContentEntityTypeInterface|NULL
   */
  public function getEntityType($entity_type_id) {
    if (isset($this->entityTypes[$entity_type_id]) && $this->entityTypes[$entity_type_id] instanceof ContentEntityTypeInterface) {
      return $this->entityTypes[$entity_type_id];
    }
    return NULL;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MultiversionManagerEvent::$entityTypes protected property List of entity types keyed with their entity id.
MultiversionManagerEvent::$op protected property Operation type name.
MultiversionManagerEvent::getEntityType public function It helps the event subscriber to validate the entity_type_id value.
MultiversionManagerEvent::getEntityTypes public function Get the list of entity types.
MultiversionManagerEvent::getOp public function Get the operation type value.
MultiversionManagerEvent::__construct public function Constructor.