contao/docs-archive

tinyCumstom.php for all fields that use tinyMCE.php

Opened this issue · 4 comments

Aybee commented

Hello, mostly people wish that a tinyCustom.php gets used for all fields that actually use the tinyMCE.php configuration.

I think on this page https://docs.contao.org/books/cookbook/customizing-contao/customizing-tinymce.html we should add the solution for achieving this.

// Use tinyCustom.php for all textareas that use tinyMCE.php
if(is_file(TL_ROOT.'/system/config/tinyCustom.php'))
{
  array_walk_recursive($GLOBALS['TL_DCA'], function(&$v, $k){
    if($k === 'rte' && $v === 'tinyMCE')
    {
      $v = 'tinyCustom';
    }
  });
}

why would you use tinyCustom for everything and not just change tinyMCE ?

Aybee commented

If I change tinyMCE.php, it's not update safe.

why would you use tinyCustom for everything and not just change tinyMCE ?

That's not recommended, since these changes will get lost during an update. The recommended way is described here in the official Contao cookbook: https://docs.contao.org/books/cookbook/customizing-contao/customizing-tinymce.html

Please create a pull request for the necessary changes, but make sure to follow PSR-2 coding style.

Also be aware that this is no longer necessary in Contao 4, as the tinyMCE file is now a template that will not be overwritten on update.