Affichage des articles dont le libellé est add tinyMCE prestashop. Afficher tous les articles
Affichage des articles dont le libellé est add tinyMCE prestashop. Afficher tous les articles

lundi 29 juin 2015

Add TinyMCE field to prestashop

If you look to add a tinyMCE form field to prestashop module, or to an existant page in Back end or Front end.
PS: i suppose that you are using the helperForm to create your form
You should add  'tinymce' => true, and 'autoload_rte' => true, to the form array,
in this example, i'm using a textarea for the tinyMCE field.


 $fields_form[0]['form'] = array(
                   'tinymce' => true,
                   'legend' => array(
                                     'title' => $this->l('Ajout de règle'),
                                   ),
                                 'input' => array(
    
              
                   array(
                       'type' => 'textarea',
                        'label' => $this->l('Texte du Champ'),
                                                    'name' => 'text',
                        'cols' => 40,
                        'rows' => 10,
                        'class' => 'rte',
                        'autoload_rte' => true,
                   )
                                    )
                          ); 
Nothing special to use it in the controller:
Tools::getValue('text');
text is the field name.

In your class you should declare a html type field like this
'text' => array(
  'type' => ObjectModel :: TYPE_HTML, 'validate' => 'isString'
     ),



Hope i was so clear.