Form input type Editor

How set form input type as "html editor" in phalcon?



32.7k

You should create your own element. See http://docs.phalconphp.com/en/latest/reference/forms.html#creating-form-elements and decorate them. Or a more simple idea: use a textArea form element with something like ckEditor (for ckeditor you can provide a textarea element id and it will automatically convert it to WYSIWYG editor. )



1.3k

not clear,please give example



32.7k

Method 1: Create your own element and decorate it:

<?php

use Phalcon\Forms\Element;

class HtmlTextAreaElement extends Element
{
    public function render($attributes=null)
    {
        $html = '<your HTML code here>';
        return $html;
    }
}

Method 2: Use ckeditor or something similar with TextareaElement:

    use \Phalcon\Forms\Element\TextArea;
    $textarea = new Texarea('my_field');

A Textarea element will produce this:

    <textarea name="my_field" id="my_field"></textarea>

In your template, using ckedior (http://docs.ckeditor.com/#!/guide/dev%5installation-section-adding-ckeditor-to-your-page) :

    <script>
       CKEDITOR.replace( 'my_field' );
    </script>


1.3k

how integrate CKEDITOR in phalcon?



32.7k

You don't need to integrate it in PHALCON. You can integrate it in any HTML page with a textarea element. Please read their docs: http://docs.ckeditor.com/#!/guide/dev%5installation