コード例 #1
0
    public function render($name, $value = null, $attributes = array(), $errors = array())
    {
        //$textarea = parent::render($name, $value, $attributes, $errors);
        //La ligne ci-dessous est utilisée contrairement à celle au dessus pour
        //permettre l'utilisation du code tel que saisit par l'utilisateur ( htmlentities($value) )
        $textarea = parent::renderContentTag('textarea', htmlentities($value), array_merge(array('name' => $name), $attributes));
        $js = sprintf(<<<EOF
    <script type="text/javascript">
    \$(document).ready(function() {
        tinymce.init({
                selector: "textarea.tinyMceContent , textarea.tinyMceNoticeExpect ,textarea.tinyMceNoticeResult", 
                paste_data_images: true , 
                plugins: [
                    " example advlist autolink lists link image charmap print preview anchor",
                    "searchreplace visualblocks code fullscreen",
                    "insertdatetime media table  paste "
                ],   
                menu : { 
                    //edit: { title: 'Edit', items: 'undo redo  | cut copy paste selectall | searchreplace' },
                    insert: { title: 'Insert', items: 'link charmap' },
                    format: { title: 'Format', items: 'bold italic underline strikethrough superscript subscript | removeformat' },
                    table: { title: 'Table', items: 'inserttable tableprops deletetable | cell row column' }
                  },
                //menubar: "file edit format table view insert tools parameters",
                entity_encoding: "raw",
                toolbar: " undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent "
                
            });
    });
       

    </script>
EOF
, $this->generateId($name), $this->getOption('width') ? sprintf('width:                             "%spx",', $this->getOption('width')) : '', $this->getOption('height') ? sprintf('height:                            "%spx",', $this->getOption('height')) : '', $this->getOption('config') ? ",\n" . $this->getOption('config') : '');
        return $textarea . $js;
    }