We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Form input type Editor

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



51.2k

You should create your own element. See https://docs.phalcon.io/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. )



2.9k

not clear,please give example



51.2k

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 (https://docs.ckeditor.com/#!/guide/dev_installation-section-adding-ckeditor-to-your-page) :

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


2.9k

how integrate CKEDITOR in phalcon?



51.2k

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: https://docs.ckeditor.com/#!/guide/dev_installation