You are here

protected function HierarchyIsSiblingOfEntityRevision::loadEntity in Entity Reference Hierarchy 3.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/views/argument/HierarchyIsSiblingOfEntityRevision.php \Drupal\entity_hierarchy\Plugin\views\argument\HierarchyIsSiblingOfEntityRevision::loadEntity()

Loads the parent entity from the argument.

Return value

\Drupal\Core\Entity\EntityInterface Parent entity if exists.

Overrides EntityHierarchyArgumentPluginBase::loadEntity

File

src/Plugin/views/argument/HierarchyIsSiblingOfEntityRevision.php, line 17

Class

HierarchyIsSiblingOfEntityRevision
Argument to limit to parent of a revision.

Namespace

Drupal\entity_hierarchy\Plugin\views\argument

Code

protected function loadEntity() {
  $storage = $this->entityTypeManager
    ->getStorage($this
    ->getEntityType());
  return $storage
    ->loadRevision($this->argument) ?: $storage
    ->load($this->argument);
}