You are here

protected function ClassUtilsTrait::getEntityOwner in Scheduled Updates 8

Get the entity owner if applicable.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity:

Return value

\Drupal\user\UserInterface|null

1 call to ClassUtilsTrait::getEntityOwner()
BaseUpdateRunner::switchUser in src/Plugin/BaseUpdateRunner.php
Switch to another user to run an update if necessary.

File

src/ClassUtilsTrait.php, line 88
Contains \Drupal\scheduled_updates\ClassUtilsTrait.

Class

ClassUtilsTrait
Trait for Class related functions.

Namespace

Drupal\scheduled_updates

Code

protected function getEntityOwner(ContentEntityInterface $entity) {
  if ($entity instanceof EntityOwnerInterface) {
    return $entity
      ->getOwner();
  }
  return NULL;
}