You are here

class RestoreDeriver in Workbench Moderation to Content Moderation 8.2

Hierarchy

Expanded class hierarchy of RestoreDeriver

1 string reference to 'RestoreDeriver'
wbm2cm_restore.yml in migrations/wbm2cm_restore.yml
migrations/wbm2cm_restore.yml

File

src/Plugin/Deriver/RestoreDeriver.php, line 5

Namespace

Drupal\wbm2cm\Plugin\Deriver
View source
class RestoreDeriver extends ModerationDeriver {

  /**
   * {@inheritdoc}
   */
  public function getDerivativeDefinitions($base_plugin_definition) {
    $this->derivatives = parent::getDerivativeDefinitions($base_plugin_definition);
    foreach ($this->derivatives as $id => &$derivative) {
      $keys = $this->entityTypeManager
        ->getDefinition($id)
        ->getKeys();
      $derivative['source']['plugin'] = "content_entity_revision:{$id}";
      foreach ([
        'id',
        'revision',
        'langcode',
      ] as $key) {
        $key = $keys[$key];
        $derivative['process'][$key] = $key;
      }
      $derivative['process']['moderation_state'][0] += [
        'source' => [
          $keys['id'],
          $keys['revision'],
          $keys['langcode'],
        ],
        'migration' => [
          "wbm2cm_save:{$id}",
        ],
      ];
      $derivative['destination']['plugin'] = "entity_revision:{$id}";
      $derivative['migration_dependencies']['required'][] = "wbm2cm_save:{$id}";
    }
    return $this->derivatives;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ContentEntityDeriver::$entityTypeManager protected property The entity type manager service.
DeriverBase::$derivatives protected property List of derivative definitions. 1
DeriverBase::getDerivativeDefinition public function Gets the definition of a derivative plugin. Overrides DeriverInterface::getDerivativeDefinition
ModerationDeriver::$entityTypes protected property The moderatable entity type IDs.
ModerationDeriver::create public static function Creates a new class instance. Overrides ContentEntityDeriver::create
ModerationDeriver::isCompatible protected function Determines if an entity type can be used by the derived plugin. Overrides ContentEntityDeriver::isCompatible
ModerationDeriver::__construct public function EntityModerationStateDeriver constructor. Overrides ContentEntityDeriver::__construct
RestoreDeriver::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides ModerationDeriver::getDerivativeDefinitions