0

Today I'm using the textarea, but I want to improve with the WYSIWYG.

Thanks

5

Add following code in your file.

app/code/Namespace/Modulename/Block/Adminhtml/ModuleFolder/Edit/Tab/Main.php

protected $wysiwyg;

public function __construct(
    \Magento\Cms\Model\Wysiwyg\Config $wysiwyg
    ){
       $this->wysiwyg = $wysiwyg;
     }

$fieldset->addField(
            'fieldname',
            'editor',
            [
                'name' => 'fieldname',
                'label' => __('Fieldname'),
                'title' => __('Fieldname'),
                 'config'    => $this->wysiwyg->getConfig(),
                'wysiwyg'   => true
            ]
        );

Done. You can see WYSIWYG in your Admin form of your Custom Module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.