getPrevVersionUniqueId() public method

Get the previous version's unique ID
public getPrevVersionUniqueId ( integer $postId, integer $currentVersionId ) : string
$postId integer
$currentVersionId integer
return string
Example #1
0
 /**
  * View a version of a blog post.
  *
  * @param string $postID
  * @param string $uniqueID
  *
  * @route blog/post/history/{id}/view/{string}
  */
 public function postHistoryView(string $postID = '', string $uniqueID = '')
 {
     $postID = (int) $postID;
     $blog = $this->blog->getBlogPostById($postID);
     if (!$blog || !$this->can('read')) {
         \Airship\redirect($this->airship_cabin_prefix . '/blog/post');
     }
     $blog['tags'] = $this->blog->getTagsForPost($postID);
     $version = $this->blog->getBlogPostVersionByUniqueId($uniqueID);
     if ((int) $version['postid'] !== $postID || empty($version)) {
         \Airship\redirect($this->airship_cabin_prefix . '/blog/post/history/' . $postID);
     }
     if ($this->isSuperUser()) {
         $authors = $this->author->getAll();
     } else {
         $authors = $this->author->getForUser($this->getActiveUserId());
     }
     $categories = $this->blog->getCategoryTree();
     $tags = $this->blog->getTags();
     $this->lens('blog/post_history_view', ['active_link' => 'bridge-link-blog-posts', 'authors' => $authors, 'blogpost' => $blog, 'categories' => $categories, 'tags' => $tags, 'title' => \__('Revision for  Blog Post "%s"', 'default', Util::noHTML($blog['title'])), 'prev_uniqueid' => $this->blog->getPrevVersionUniqueId($postID, (int) $version['versionid']), 'next_uniqueid' => $this->blog->getNextVersionUniqueId($postID, (int) $version['versionid']), 'version' => $version]);
 }