Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Wysiwyg.php
Go to the documentation of this file.
1 <?php
7 
14 
21 class Wysiwyg extends AbstractElement
22 {
23  const NAME = 'wysiwyg';
24 
29  protected $form;
30 
35  protected $editor;
36 
45  public function __construct(
47  FormFactory $formFactory,
48  ConfigInterface $wysiwygConfig,
49  array $components = [],
50  array $data = [],
51  array $config = []
52  ) {
53  $wysiwygConfigData = isset($config['wysiwygConfigData']) ? $config['wysiwygConfigData'] : [];
54  $this->form = $formFactory->create();
55  $wysiwygId = $context->getNamespace() . '_' . $data['name'];
56  $this->editor = $this->form->addField(
57  $wysiwygId,
58  \Magento\Framework\Data\Form\Element\Editor::class,
59  [
60  'force_load' => true,
61  'rows' => isset($config['rows']) ? $config['rows'] : 20,
62  'name' => $data['name'],
63  'config' => $wysiwygConfig->getConfig($wysiwygConfigData),
64  'wysiwyg' => isset($config['wysiwyg']) ? $config['wysiwyg'] : null,
65  ]
66  );
67  $data['config']['content'] = $this->editor->getElementHtml();
68  $data['config']['wysiwygId'] = $wysiwygId;
69 
70  parent::__construct($context, $components, $data);
71  }
72 
79  public function getComponentName()
80  {
81  return static::NAME;
82  }
83 }
__construct(ContextInterface $context, FormFactory $formFactory, ConfigInterface $wysiwygConfig, array $components=[], array $data=[], array $config=[])
Definition: Wysiwyg.php:45
$config
Definition: fraud_order.php:17
jquery extjs ext tree mage adminhtml form
Definition: tree.phtml:41