PHP code example of gorriecoe / silverstripe-dataobjecthistory

1. Go to this page and download the library: Download gorriecoe/silverstripe-dataobjecthistory library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gorriecoe / silverstripe-dataobjecthistory example snippets




use SilverStripe\Versioned\Versioned;
use gorriecoe\DataObjectHistory\extensions\DataObjectHistory;

class MyObject extends DataObject
{
    private static $extensions = [
        Versioned::class . '.versioned',
        DataObjectHistory::class
    ];

    public function getCMSFields()
    {
        $fields = FieldList::create();
        ...
        $this->extend('updateCMSFields', $fields); // Required
        return $fields;
    }
}