public function ConfigEntityRevisionsConfigTrait::getContentEntity in Config Entity Revisions 8
Same name and namespace in other branches
- 1.x src/ConfigEntityRevisionsConfigTrait.php \Drupal\config_entity_revisions\ConfigEntityRevisionsConfigTrait::getContentEntity()
Default revision of revisions entity that matches the config entity.
Return value
\Drupal\Core\Entity\EntityInterface|null The matching entity.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
File
- src/
ConfigEntityRevisionsConfigTrait.php, line 81
Class
Namespace
Drupal\config_entity_revisionsCode
public function getContentEntity() {
$contentEntityID = $this
->getContentEntityID();
if (!$contentEntityID) {
return NULL;
}
/* @var $storage \Drupal\Core\Entity\ContentEntityStorageInterface */
$storage = $this
->contentEntityStorage();
// Get the matching revision ID if one is provided.
if ($this
->getRevisionId()) {
return $storage
->loadRevision($this
->getRevisionId());
}
// Otherwise, just get the default revision.
return $storage
->load($contentEntityID);
}