Jump to content

Formulaire création module PrestaShop


Recommended Posts

Bonjour,

J'ai créé un module pour mon site pour la première fois.

Dans la doc de PrestaShop pour la création d'un module, il montre ce script

À la fonction public function displayForm()

            $form = array(
                'form' => array(
                    'legend' => array(
                        'title' => $this->l('Settings'),
                    ),
                    'input' => array(
                        array(
                            'type' => 'text',
                            'label' => $this->l('Configuration value'),
                            'name' => 'MODULE_TEXT',
                            'size' => 20,
                            'required' => true,
                            'autoload_rte' => true,
                        )
                    ),
                    'submit' => array(
                        'title' => $this->l('Save'),
                        'name'  => 'save'
                    )
                ),
            );

Comme j'enregistre des balises HTML dans ce formulaire, j'ai remplacé 'type' => 'text', par 'type' => 'textarea', et ajouté 'autoload_rte' => true

À la place de 'size' => 20, faut t'il  remplacer par ?

                    'cols' => 40,
                    'rows' => 10,

Dois-je ajouter 'lang' => true et 'class' => 'rte', ?

J'ai trouvé ceci dans le module ps_customtext.php

Link to comment
Share on other sites

We want to tell you that you can replace size with cols and rows respectively.

Also, for creating multilingual fields with a tiny mice editor, you need to use autoload_rte and lang.

Image for your reference:  https://nimbusweb.me/nimbus-screenshots/0abadca48aef733333d73a794e8ec6b7

https://devdocs.prestashop.com/1.7/development/components/helpers/helperform/

Link to comment
Share on other sites

On 12/13/2021 at 12:05 PM, Knowband Plugins said:

We want to tell you that you can replace size with cols and rows respectively.

Also, for creating multilingual fields with a tiny mice editor, you need to use autoload_rte and lang.

Image for your reference:  https://nimbusweb.me/nimbus-screenshots/0abadca48aef733333d73a794e8ec6b7

https://devdocs.prestashop.com/1.7/development/components/helpers/helperform/

Merci de m'avoir répondu.

Je ne comprends pas pourquoi lorsque j'ajoute 'lang' => true, le champ pour écrire disparait dans le formulaire ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...