How to disable WYSIWYG editor for one specific mysql text field?

edited April 2013 in Modules
I would like to have a multi-line text area for a text field of a model, based on the Base_module_model. without the wysiwyg editor.
In other words no html, just plain text to input a paragraph of text wikthout the paragraph tags. I've been trying and haven't been successful with "Custom Fields Objects"
Using fuel version 1

Comments

  • edited 5:14AM
    just add 'class' => 'no_editor' as a parameter to your field
  • edited 5:14AM
    Thanks for taking the time to respond. config/custom_fields.php contains this line

    $fields['plaintext'] = array('type' => 'textarea', 'cols' => 40, 'rows' => 5, 'class' => 'no_editor');

    and my buildings modul

    class Buildings_model extends Base_module_model {
    public $custom_fields = array('address' =>'plaintext');


    now when I try to edit a building I get this exception:

    Fatal error: Uncaught exception 'Exception' with message 'Invalid custom class associated with the field address.'
  • edited 5:14AM
    OK. Found it in the docs, I didn't know to override form_fields function, I thought I had to modify the custom_fields value

    function form_fields($values = array())
    {
    $fields = parent::form_fields($values);
    $fields['address']['class']= 'no_editor';
    return $fields;
    }
Sign In or Register to comment.