PHP code example of toastnz / silverstripe-design-field

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

    

toastnz / silverstripe-design-field example snippets


private static $db = array(
  'MyObject' => 'Design'
);

DesignField::create('MyObject', _t('DesignField.MyObject', 'My Object'),
  '.myobject',
  array(
      'padding-top' => 'TextField',
      'padding-right' => 'TextField',
      'padding-bottom' => 'TextField',
      'padding-left' => 'TextField',
      'margin-top' => 'TextField',
      'margin-right' => 'TextField',
      'margin-bottom' => 'TextField',
      'margin-left' => 'TextField',
      'color' => 'ColorField',
      'background' => 'ColorField',
      'font-size' => array(
          'type' => 'DropdownField',
          'value' => array(
              '16px',
              '25px',
              '36px'
          )
      )
  ));

$this->dbObject('MyObject')->InlineStyle();