PHP code example of iliain / silverstripe-droppable

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

    

iliain / silverstripe-droppable example snippets


use Iliain\Droppable\Fields\DroppableField;

$blockContent = TextareaField::create('BlockContent', 'Block Content');

$droppable = DroppableField::create('Example', 'Example', 'BlockContent')
    ->setButtonRow(0, [
        ['[OPTION_1]', 'Option 1'],
        ['[OPTION_2]', 'Option 2'],
    ])
    ->setButtonRow(1, [
        ['[OPTION_3]', 'Option 3']
    ])
    ->pushButton(1, ['[OPTION_4]', 'Option 4']);

$droppable->setWrapSelection(true);
$droppable->setWrapElement('<div class="$2">$1</div>');