2017 © Pedro Peláez
 

silverstripe-module silverstripe-design-field

Silverstripe Design Field

image

toastnz/silverstripe-design-field

Silverstripe Design Field

  • Friday, September 11, 2015
  • by permanentinc
  • Repository
  • 4 Watchers
  • 0 Stars
  • 23 Installations
  • CSS
  • 2 Dependents
  • 0 Suggesters
  • 2 Forks
  • 2 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Silverstripe Design Field

A field that can generate inline styles for an object. The field is saved into the database as a JSON string. Here's an example of the output:, (*1)

{  
   "selector":".myobject",
   "padding-top":"100px",
   "padding-bottom":"100px",
   "margin-top":"10px",
   "margin-bottom":"10px",
   "background":"#ffffff"
}

Methods Summary

  • | - ---- | ---- public | __construct($name, $title = null, $selector = null, $fields = null, $value = null) The $fields parameter supports pretty much all silverstripe fields, bar UploadFields and FileFields.

Screenshot

Design Field, (*2)

Example Usage

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'
          )
      )
  ));

Return the string of styles, (*3)

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

The Versions

11/09 2015

dev-master

9999999-dev

Silverstripe Design Field

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe

26/08 2015

0.1.1

0.1.1.0

Silverstripe Design Field

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe

26/08 2015

0.1.0

0.1.0.0

Silverstripe Design Field

  Sources   Download

BSD-3-Clause

The Requires

 

silverstripe