PHP code example of restruct / silverstripe-quickaddnew

1. Go to this page and download the library: Download restruct/silverstripe-quickaddnew 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/ */

    

restruct / silverstripe-quickaddnew example snippets


$source = function(){
    return MyObject::get()->map()->toArray();
};

$field = DropdownField::create('MyObjectID', 'My Object', $source());

$field->useAddNew('MyObject', $source);

$fields->addFieldToTab('Root.Main', $field);