2017 © Pedro Peláez
 

silverstripe-module silverstripe-data-object-version-viewer

Allows viewing of version history for data objects inside of the SilverStripe CMS

image

bluehousegroup/silverstripe-data-object-version-viewer

Allows viewing of version history for data objects inside of the SilverStripe CMS

  • Thursday, May 18, 2017
  • by andrew@bluehousegroup.com
  • Repository
  • 16 Watchers
  • 16 Stars
  • 7,006 Installations
  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 6 Forks
  • 7 Open issues
  • 4 Versions
  • 5 % Grown

The README.md

Data Object Version Viewer

Screenshot, (*1)

Install with Composer

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

Usage

  • Extend silverstripe-versioneddataobjects to add a 'History' button to a GridField or ModelAdmin
  • View, revert to, and publish a previous versions of a data object

Example code

The implementation is very similar to the versioneddataobjects module, on which this module depends., (*2)

Within your DataObject class

class Slice extends DataObject
{
    private static $db = [
        'Content' => 'Text'
    ];

    private static $has_one = [
        'Parent' => 'SiteTree'
    ];

    private static $extensions = [
        'Heyday\VersionedDataObjects\VersionedDataObject'
    ];
}

To use VersionedDataObject records in a GridField, GridFieldDetailForm needs to be replaced with VersionedRevertDODetailsForm:, (*3)

// ...

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

    $fields->addFieldToTab(
        'Root.Slices',
        new GridField(
            'Slices',
            'Slices',
            $this->Slices(),
            $config = GridFieldConfig_RelationEditor::create()
        )
    );

    $config->removeComponentsByType('GridFieldDetailForm');
    $config->addComponent(new VersionedRevertDODetailsForm());

    return $fields;
}

// ...

Versioned DataObjects in a ModelAdmin

class SliceAdmin extends VersionedRevertModelAdmin
{
    private static $menu_title = 'Slices';

    private static $url_segment = 'slice';

    private static $managed_models = [
        'Slice'
    ];
}

Notes

This module is intended to be compatible with the betterbuttons module. Toward that end, it removes the betterbuttons's Versioning button group in order to keep in tact the buttons added by the versiondataobjects plug-in. This change affects only the forms configured with the VersionedRevertDODetailsForm extension., (*4)

The Versions

18/05 2017

dev-master

9999999-dev https://github.com/bluehousegroup/silverstripe-data-object-version-viewer

Allows viewing of version history for data objects inside of the SilverStripe CMS

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe version data objects

29/03 2017

dev-revertable

dev-revertable https://github.com/bluehousegroup/silverstripe-data-object-version-viewer

Allows viewing of version history for data objects inside of the SilverStripe CMS

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe version data objects

10/03 2017

0.1

0.1.0.0 https://github.com/bluehousegroup/silverstripe-data-object-version-viewer

Allows viewing of version history for data objects inside of the SilverStripe CMS

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe version data objects

03/02 2016

dev-master-2016-06-24

dev-master-2016-06-24 https://github.com/bluehousegroup/silverstripe-data-object-version-viewer

Allows viewing of version history for data objects inside of the SilverStripe CMS

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe version data objects