Source of file Color.php
Size: 1,682 Bytes - Last Modified: 2018-07-02T11:52:15+00:00
/var/www/docs.ssmods.com/process/src/code/Color.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 | <?php class Color extends StyleObject { /** * FIELDS */ private static $db = array( 'Name' => 'Text', 'Value' => 'Text' ); /** * DEFAULT RECORDS */ private static $default_records = array( array( 'Name' => 'Transparent', 'Value' => 'transparent' ), array( 'Name' => 'Black', 'Value' => '#000000' ), array( 'Name' => 'Black Moderate Transparent', 'Value' => 'rgba(0,0,0,0.5)' ), array( 'Name' => 'White', 'Value' => '#FFFFFF' ), array( 'Name' => 'Red', 'Value' => '#FF0000' ), array( 'Name' => 'Green', 'Value' => '#00FF00' ), array( 'Name' => 'Blue', 'Value' => '#0000FF' ) ); /** * CONFIGURATION */ private static $default_sort='Name ASC'; private static $summary_fields = array( 'Name' => 'Name', 'Value' => 'Value', 'CMSPreview' => 'Preview' ); /** * CMS FIELDS */ public function getCMSFields() { $fields = parent::getCMSFields(); /** * MAIN TAB */ $tab = 'Root.Main'; $field = new TextField('Name'); $fields->addFieldToTab($tab, $field); $field = new TextField('Value'); $fields->addFieldToTab($tab, $field); $html = ViewableData::renderWith('Color_CMS_Preview'); $field = new LiteralField('Preview', $html); $fields->addFieldToTab($tab, $field); return $fields; } public function getCMSPreview() { $html = ViewableData::renderWith('Color_CMS_Preview'); $obj = HTMLText::create(); $obj->setValue($html); return $obj; } } |