private function ViewRevisionsPreviewForm::getRevisionId in Config Entity Revisions 8.2
Get revision id, reloading view if it has only just been created.
Parameters
\Drupal\views\Entity\View $view: The view from which a revision ID should be retrieved.
Return value
int The revision ID for the view.
2 calls to ViewRevisionsPreviewForm::getRevisionId()
- ViewRevisionsPreviewForm::actions in modules/view_revisions/ src/ ViewRevisionsPreviewForm.php 
- Returns an array of supported actions for the current entity form.
- ViewRevisionsPreviewForm::form in modules/view_revisions/ src/ ViewRevisionsPreviewForm.php 
- Gets the actual form array to be built.
File
- modules/view_revisions/ src/ ViewRevisionsPreviewForm.php, line 33 
Class
- ViewRevisionsPreviewForm
- Class ViewRevisionsPreviewForm.
Namespace
Drupal\view_revisionsCode
private function getRevisionId(View $view) {
  if (!is_null($this->revisionId)) {
    return $this->revisionId;
  }
  $this->revisionId = $view
    ->get('loadedRevisionId');
  if (is_null($this->revisionId)) {
    // A new view has just been created. The revision has been made too, but
    // it's not in the entities provided. We need to get it directly from the
    // database.
    $reloaded = $this->entityTypeManager
      ->getStorage('view')
      ->load($view
      ->id());
    $config_entity_id = $reloaded
      ->getContentEntityId();
    $revision = $reloaded
      ->contentEntityStorage()
      ->getLatestRevision($config_entity_id);
    $this->revisionId = $revision
      ->id();
  }
  return $this->revisionId;
}