2

I wanted to create WYSIWYG editor in custom form frontend.

What I tried doing is :

  1. Created WysiwygConfig.php file inside Vendor/Extension/Plugin directory with code :

    class WysiwygConfig {
        public function afterGetConfig($subject, \Magento\Framework\DataObject $config)
        {
            $styleArray = [
                'Hero - Image' => 'hero__image',
                'Hero - Heading' => 'hero__heading',
                'Hero - Action Button' => 'hero__primary-action'
            ];
    
            $styles = array_map(function($title, $class) {
                return "{$title}={$class}; ";
            }, array_keys($styleArray), array_values($styleArray));
    
            $config->addData(["settings" => ["theme_advanced_styles" => implode("; ", $styles)]]);
    
            return $config;
        }
    }
    ?>
    
  2. Created di.xml file inside Vendor/Extension/etc/ folder and provided plugin name with type.

  3. I have frontend template where I want to implement WYSIWYG editor.

I had followed one tutorial but that one is incomplete for me. Please help me to do it.

2
  • Can you share what issue facing while you followed that link? Commented Feb 9, 2017 at 13:39
  • @Sagar: Please share the tutorial URL which you follow to add WYSIWYG editor in frontend form field. I also want to add WYSIWYG editor. Commented Sep 1, 2017 at 8:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.