count page versions / get current version

Permalink
I need to get total page versions for the current page for an if statement based on the number of versions. I've been poking around and haven't come across how to do this. Hopefully someone has a nudge in the right direction for me ?? :)

enlil
 
enlil replied on at Permalink Best Answer Reply
enlil
$page->getVersionID()


the example below demonstrates what i was trying to accomplish. To only post the update event to the wall from site_events.php if the page version is greater than 1 !!

class EnlilUpdatePage {
   public function hookPageUpdate(Page $page) {
      if ($page->getVersionID() >= 2) {
      if ($page->getCollectionTypeHandle() == 'blog_right') {
         $wall = Loader::package('lerteco_wall');
         $u = new User();
            $posting_type = array('enlil_transparency', 'blog_post_right_update', 'Enlil Blog Right Update', 'Updated a blog: %1$p', 1, PostingType::SHAREWITH_ALL);
            $wall->postAndPossiblyRegister($u->getUserID(), $page->getCollectionID(), $posting_type);
      }
      }
   }
}


Problem solved!!
JohntheFish replied on at Permalink Reply
JohntheFish
From concrete/tools/versions.php
$vl = new VersionList($c,20, $page);
$total = $vl->getVersionListCount();
$vArray = $vl->getVersionListArray();


$c is the page object
$page is for pagination of the list, so starts at 1 (or maybe 0)
The above is cropped to 20 versions.