PHP code example of sheadawson / quickaddnew

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

    

sheadawson / quickaddnew example snippets


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

$field = DropdownField::create('MyObjectID', 'My Object', $source());
// or...
$field = ListboxField::create('MyObjects', 'My Objects', $source());
// or...
$field = CheckboxSetField::create('MyObjects', 'My Objects', $source());

$field->useAddNew('MyObject', $source);
// or...
$field->useAddNew('MyObject', $source, $fields, $

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