You are here

protected function GeysirControllerBase::getParentRevisionOrParent in Geysir 8

Parameters

$parent_entity_type:

$parent_entity_revision:

Return value

\Drupal\Core\Entity\EntityInterface|null

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

3 calls to GeysirControllerBase::getParentRevisionOrParent()
GeysirCutPasteController::cut in src/Controller/GeysirCutPasteController.php
Cut a paragraph entity.
GeysirCutPasteController::paste in src/Controller/GeysirCutPasteController.php
Paste a paragraph entity before/after another paragraph on the given delta.
GeysirModalController::add in src/Controller/GeysirModalController.php
Create a modal dialog to add a single paragraph.

File

src/Controller/GeysirControllerBase.php, line 87

Class

GeysirControllerBase

Namespace

Drupal\geysir\Controller

Code

protected function getParentRevisionOrParent($parent_entity_type, $parent_entity_revision) {
  $entity_storage = $this->entityTypeManager
    ->getStorage($parent_entity_type);
  if ($this->entityTypeManager
    ->getDefinition($parent_entity_type)
    ->isRevisionable()) {
    return $entity_storage
      ->loadRevision($parent_entity_revision);
  }
  else {
    return $entity_storage
      ->load($parent_entity_revision);
  }
}