You are here

protected function GeysirParagraphForm::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

4 calls to GeysirParagraphForm::getParentRevisionOrParent()
GeysirModalParagraphAddForm::save in src/Form/GeysirModalParagraphAddForm.php
Form submission handler for the 'save' action.
GeysirModalParagraphForm::ajaxSave in src/Form/GeysirModalParagraphForm.php
GeysirParagraphForm::form in src/Form/GeysirParagraphForm.php
Gets the actual form array to be built.
GeysirParagraphForm::save in src/Form/GeysirParagraphForm.php

File

src/Form/GeysirParagraphForm.php, line 84

Class

GeysirParagraphForm
Functionality to edit a paragraph.

Namespace

Drupal\geysir\Form

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);
  }
}