getRevision() public static method

Get a revision for an item
public static getRevision ( string $url, integer $revision ) : array
$url string The URL for the item to get.
$revision integer The revisionID.
return array
Example #1
0
 /**
  * Load the data, don't forget to validate the incoming data
  */
 private function getData()
 {
     // validate incoming parameters
     if ($this->URL->getParameter(1) === null) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     // load revision
     if ($this->URL->getParameter('revision', 'int') != 0) {
         // get data
         $this->record = FrontendBlogModel::getRevision($this->URL->getParameter(1), $this->URL->getParameter('revision', 'int'));
         // add no-index, so the draft won't get accidentally indexed
         $this->header->addMetaData(array('name' => 'robots', 'content' => 'noindex, nofollow'), true);
     } else {
         // get by URL
         $this->record = FrontendBlogModel::get($this->URL->getParameter(1));
     }
     // anything found?
     if (empty($this->record)) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     // get comments
     $this->comments = FrontendBlogModel::getComments($this->record['id']);
     // get tags
     $this->record['tags'] = FrontendTagsModel::getForItem('Blog', $this->record['id']);
     // get settings
     $this->settings = $this->get('fork.settings')->getForModule('Blog');
     // overwrite URLs
     $this->record['category_full_url'] = FrontendNavigation::getURLForBlock('Blog', 'Category') . '/' . $this->record['category_url'];
     $this->record['full_url'] = FrontendNavigation::getURLForBlock('Blog', 'Detail') . '/' . $this->record['url'];
     $this->record['allow_comments'] = $this->record['allow_comments'] == 'Y';
     $this->record['comments_count'] = count($this->comments);
     // reset allow comments
     if (!$this->settings['allow_comments']) {
         $this->record['allow_comments'] = false;
     }
 }