heyday/silverstripe-versioneddataobjects

There is no license information available for the latest version (1.4.0) of this package.

Provides Versioned DataObjects in SilverStripe

Installs: 4 293

Dependents: 4

Stars: 12

Watchers: 21

Forks: 13

Open Issues: 5

Type: silverstripe-module

1.4.0 2015-11-17 03:47 UTC

README

Provides Versioned DataObjects and CMS publishing buttons in SilverStripe

Installation (with composer)

$ composer require heyday/silverstripe-versioneddataobjects

BetterButtons Integration

This module works with unclecheese/betterbuttons version 1.2.8

Example

Versioned DataObject Example Versioned DataObject Example 2

Usage

Slice.php

class Slice extends DataObject
{
    private static $has_one = array(
        'Parent' => 'SiteTree'
    );
    private static $extensions = array(
        'VersionedDataObject'
    );
}

Page.php

class Page extends SiteTree
{
    private static $has_many = array(
        'Slices' => 'Slice'
    );
    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 VersionedDataObjectDetailsForm());

        return $fields;
    }
}

Unit testing

None :(

License

SilverStripe Versioned DataObjects is licensed under an MIT license