PHP code example of nathancox / customhtmleditorfield

1. Go to this page and download the library: Download nathancox/customhtmleditorfield library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nathancox / customhtmleditorfield example snippets




// in _config.php:

// make a new TinyMCE config called "footer" by copying the default ("cms") config
$footerConfig = CustomHtmlEditorConfig::copy('footer', 'cms');
// remove the third row of the editor toolbar: no tables in the footer!
$footerConfig->setButtonsForLine(3, array());


// in getCMSFields()

// make an HtmlEditorField
$fields->addFieldToTab('Root.Footer', $footerField = new HtmlEditorField('FooterText', 'Footer'));

// assign the "footer" TinyMCE config to this field
$footerField->setEditorConfig('footer');

// set the editor's body class.  This will make it class="typography footer-content"
$footerField->setBodyClass('footer-content');