2017 © Pedro Peláez
 

silverstripe-module silverstripe-design-field

Silverstripe Design Field

image

ryanpotter/silverstripe-design-field

Silverstripe Design Field

  • Monday, November 21, 2016
  • by RyanPotter
  • Repository
  • 3 Watchers
  • 7 Stars
  • 25 Installations
  • CSS
  • 2 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 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

21/11 2016

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