/magento2-ace-settings

Module add possibility to set some setting which defined in system.xml as code editor

Primary LanguagePHP

Module add possibility to set some setting which defined in system.xml as code editor. Module is support next modes:

  • html
  • javascript
  • json
  • css

Settings

By default code theme is set to down. You can change this by path:
Stores / Configuration / WS-CV-UA / Ace editor / Settings / Code theme image

Examples of using:

image

image

image

image

Code examples:

Initialization of field

<field id="html" translate="label comment" type="textarea" sortOrder="10" showInDefault="1">
    <label>Html code</label>
    <frontend_model>Wscvua\AceEditor\Block\Adminhtml\System\Config\Field\HtmlCode</frontend_model>
</field>
<field id="js" translate="label comment" type="textarea" sortOrder="20" showInDefault="1">
    <label>JS code</label>
    <frontend_model>Wscvua\AceEditor\Block\Adminhtml\System\Config\Field\JsCode</frontend_model>
</field>
<field id="json" translate="label comment" type="textarea" sortOrder="30" showInDefault="1">
    <label>JSON code</label>
    <frontend_model>Wscvua\AceEditor\Block\Adminhtml\System\Config\Field\JsonCode</frontend_model>
</field>
<field id="css" translate="label comment" type="textarea" sortOrder="40" showInDefault="1">
    <label>Css code</label>
    <frontend_model>Wscvua\AceEditor\Block\Adminhtml\System\Config\Field\CssCode</frontend_model>
</field>

Note

By default field height is 200px. For set some custom value you have to create new virtualType and set there custom height:

di.xml

<virtualType name="Wscvua\AceEditor\Block\Adminhtml\System\Config\Field\CssCodeH100"
             type="Wscvua\AceEditor\Block\Adminhtml\System\Config\Field\CssCode">
    <arguments>
      <argument name="height" xsi:type="number">500</argument>
    </arguments>
</virtualType>

system.xml

<field id="css" translate="label comment" type="textarea" sortOrder="40" showInDefault="1">
    <label>Css code</label>
    <frontend_model>Wscvua\AceEditor\Block\Adminhtml\System\Config\Field\CssCodeH100</frontend_model>
</field>