PHP code example of nswdpc / silverstripe-versioned-record-discovery

1. Go to this page and download the library: Download nswdpc/silverstripe-versioned-record-discovery 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/ */

    

nswdpc / silverstripe-versioned-record-discovery example snippets




namespace Amazing;

use SilverStripe\Admin\ModelAdmin;

class RecordModelAdmin extends ModelAdmin
{

    private static $url_segment = 'records';

    // Managed models for this ModelAdmin
    private static $managed_models = [
        VersionedRecordTypeOne::class,// we want an 'unpublished' tab for this
        VersionedRecordTypeTwo::class,// and this
        OtherRecord::class,
    ];

    /**
     * Add the following to your model admin configuration
     * Gotcha: do not use - characters in the keys!
     */
    private static $unpublished_tabs = [
        'recordtypeoneslug' => VersionedRecordTypeOne::class,
        'recordtypetwoslug' => VersionedRecordTypeTwo::class
    ];

}