Webylon 3.1 API Docs
  • Package
  • Class
  • Tree
  • Deprecated
  • Download
Version: current
  • 3.2
  • 3.1

Packages

  • auth
  • Booking
  • cart
    • shipping
    • steppedcheckout
  • Catalog
  • cms
    • assets
    • batchaction
    • batchactions
    • bulkloading
    • comments
    • content
    • core
    • export
    • newsletter
    • publishers
    • reports
    • security
    • tasks
  • Dashboard
  • DataObjectManager
  • event
  • faq
  • forms
    • actions
    • core
    • fields-basic
    • fields-dataless
    • fields-datetime
    • fields-files
    • fields-formatted
    • fields-formattedinput
    • fields-relational
    • fields-structural
    • transformations
    • validators
  • googlesitemaps
  • guestbook
  • installer
  • newsletter
  • None
  • photo
    • gallery
  • PHP
  • polls
  • recaptcha
  • sapphire
    • api
    • bulkloading
    • control
    • core
    • cron
    • dev
    • email
    • fields-formattedinput
    • filesystem
    • formatters
    • forms
    • i18n
    • integration
    • misc
    • model
    • parsers
    • search
    • security
    • tasks
    • testing
    • tools
    • validation
    • view
    • widgets
  • seo
    • open
      • graph
  • sfDateTimePlugin
  • spamprotection
  • stealth
    • captha
  • subsites
  • userform
    • pagetypes
  • userforms
  • webylon
  • widgets

Classes

  • CheckboxField
  • CheckboxField_Disabled
  • CheckboxField_Readonly
  • CheckboxSetField
  • DropdownField
  • GroupedDropdownField
  • ListboxField
  • LookupField
  • NullableField
  • OptionsetField
  • ReadonlyField
  • RoomServiceDropdownField
  • SimpleHTMLEditorField
  • SimpleTinyMCEField
  • SimpleWysiwygField
  • StateDropdownField
  • StateProvinceDropdownField
  • TextareaField
  • TextField
  1 <?php
  2 
  3 class SimpleHTMLEditorField extends TextareaField
  4 {
  5     protected $css;
  6     protected $controls = array (
  7         'strikeThrough'         =>  false,
  8         'underline'             =>  true,
  9         'insertOrderedList'     =>  true,
 10         'insertUnorderedList'   =>  true,
 11         'insertImage'           =>  false,
 12         'createLink'            =>  true,
 13         'justifyLeft'           =>  true,
 14         'justifyRight'          =>  true,
 15         'justifyCenter'         =>  true,
 16         'justifyFull'           =>  false,
 17         'cut'                   =>  false,
 18         'copy'                  =>  false,
 19         'paste'                 =>  false,
 20         'increaseFontSize'      =>  false,
 21         'decreaseFontSize'      =>  false,
 22         'h1'                    =>  false,
 23         'h2'                    =>  false,
 24         'h3'                    =>  true,
 25         'h4'                    =>  true,
 26         'h5'                    =>  true,
 27         'h6'                    =>  false,
 28         'separator08'           =>  false,
 29         'separator09'           =>  false,
 30         'html'                  =>  true,
 31         'removeFormat'          =>  true,
 32         
 33         
 34     );
 35 
 36     function __construct($name, $title = null, $config = array(), $rows = 5, $cols = 50, $value = "", $form = null) {
 37         parent::__construct($name, $title, $rows, $cols, $value, $form);
 38         $this->extraClasses = array('hidden');
 39         if(!empty($config)) {
 40             foreach($config as $k => $v) {
 41                 if($k == "css") $this->css = $v;
 42                 else if(array_key_exists($k, $this->controls))
 43                     $this->controls[$k] = $v;
 44             }
 45         }
 46     }
 47     
 48     private function getCss()
 49     {
 50         return $this->css ? "css : '{$this->css}'" : "css : ''";
 51     }
 52     
 53     private function getControls()
 54     {
 55         $controls = "controls : {\n";
 56         $first = true;
 57         foreach($this->controls as $var => $value) {
 58             $controls .= $first ? "" : ",";
 59             if((strlen($var) == 2 && $var[0] == "h") 
 60                 && stristr($_SERVER['HTTP_USER_AGENT'], "Mozilla")
 61                 && stristr($_SERVER['HTTP_USER_AGENT'], "Safari") === false
 62             ) {
 63                 $var.="mozilla";
 64             }
 65             $controls .= $var . " : ";
 66             $title = _t("SimpleHTMLEditorField.{$var}_title");
 67             $controls .= $value ? "{visible : true, title : '{$title}'}" : "{visible : false}";
 68             $controls .=  "\n";
 69             $first = false;
 70         }
 71         $controls .= "},\n";
 72         return $controls;
 73     }
 74     
 75     private function getConfig()
 76     {
 77         return $this->getControls().$this->getCss();
 78     }
 79     
 80     public function FieldHolder()
 81     {
 82         Requirements::javascript('dataobject_manager/javascript/jquery.wysiwyg.js');
 83         Requirements::css('dataobject_manager/css/jquery.wysiwyg.css');
 84         Requirements::customScript("
 85             jQuery(function() {
 86                 jQuery('#{$this->id()}').wysiwyg({
 87                     {$this->getConfig()}
 88                 }).parents('.simplehtmleditor').removeClass('hidden');
 89                 
 90             });
 91         ");
 92         return parent::FieldHolder();       
 93     }   
 94     
 95 }
 96 
 97 
 98 
 99 
100 ?>
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -
Webylon 3.1 API Docs API documentation generated by ApiGen 2.8.0