Source of file DocumentationViewerVersionWarning.php
Size: 1,549 Bytes - Last Modified: 2021-12-23T10:29:30+00:00
/var/www/docs.ssmods.com/process/src/code/extensions/DocumentationViewerVersionWarning.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 | <?php /** * @package docsviewer */ class DocumentationViewerVersionWarning extends Extension { /** * Check to see if the currently accessed version is out of date or perhaps a * future version rather than the stable edition. * * @return false|ArrayData */ public function VersionWarning() { $page = $this->owner->getPage(); if (!$page) { return false; } $entity = $page->getEntity(); if (!$entity) { return false; } $versions = $this->owner->getManifest()->getAllVersionsOfEntity($entity); if ($entity->getIsStable()) { return false; } $stable = $this->owner->getManifest()->getStableVersion($entity); $compare = $entity->compare($stable); if ($entity->getVersion() == 'master' || $compare > 0) { return $this->owner->customise( new ArrayData( array( 'FutureRelease' => true, 'StableVersion' => DBField::create_field('HTMLText', $stable->getVersion()) ) ) ); } else { return $this->owner->customise( new ArrayData( array( 'OutdatedRelease' => true, 'StableVersion' => DBField::create_field('HTMLText', $stable->getVersion()) ) ) ); } return false; } } |