Allows viewing of version history for data objects inside of the SilverStripe CMS
PHP CSS Scheme
Latest commit 9e97f89 Feb 3, 2016 @irkeepin irkeepin Update config.yml

README.md

Data Object Version Viewer

Screenshot

Install with Composer

composer require bluehousegroup/silverstripe-data-object-version-viewer

Usage

  • Call function addVersionViewer from within getCMSFields on your DataObject
  • Pass a FieldList object and a DataObject object as arguments
  • Function will return FieldList object containing:
    • All fields passed to it in the FieldList argument, within a tab named 'Current'
    • Previous versions of this data object displayed in a tab called 'History'

Example code

Within your DataObject class

class MyDataObject extends DataObject {

    // ... your class code here ...

    public function getCMSFields() {
        $fields = parent::getCMSFields();

        // If this is an exisiting record, add Version Viewer tabs
        if($this->ID) {
            $fields = $this->addVersionViewer($fields, $this);
        }

        return $fields;
    }
}