protected function ClassUtilsTrait::getRevisionOwner in Scheduled Updates 8
Get the revision owner for an ContentEntity.
Need because 2 possible interfaces support this.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity:
Return value
\Drupal\user\UserInterface|NULL
1 call to ClassUtilsTrait::getRevisionOwner()
- BaseUpdateRunner::switchUser in src/
Plugin/ BaseUpdateRunner.php - Switch to another user to run an update if necessary.
File
- src/
ClassUtilsTrait.php, line 70 - Contains \Drupal\scheduled_updates\ClassUtilsTrait.
Class
- ClassUtilsTrait
- Trait for Class related functions.
Namespace
Drupal\scheduled_updatesCode
protected function getRevisionOwner(ContentEntityInterface $entity) {
if ($entity instanceof NodeInterface) {
return $entity
->getRevisionAuthor();
}
elseif ($this
->implementsInterface($entity, [
'Drupal\\entity\\Revision\\EntityRevisionLogInterface',
])) {
/** @var \Drupal\entity\Revision\EntityRevisionLogInterface $entity */
return $entity
->getRevisionUser();
}
return NULL;
}