SilverStripe editor need more Tags? Fix it!

SilverStripe

If you are having the problem that SilverStripe editor is striping out tags that you would like to use, fix it.

This article explains. SilverStripe uses the TinyMCE editor. SilverStripe has set up to permit you to add content to the /mysite/_config.php file and extend the tags that are accepted by the SilverStripe editor.

In the /mysite/_config.php file, add the following statement:


  HtmlEditorConfig::get('cms')->setOption(
    'extended_valid_elements',
    'img[id|class|src|alt|title|hspace|vspace|width|height|' .
    'align|onmouseover|onmouseout|name|usemap],' .
    'iframe[id|class|src|name|width|height|title|align|allowfullscreen|' .
    'frameborder|marginwidth|marginheight|scrolling],' .
    'object[classid|codebase|width|height|data|type],' . 
    'embed[id|class|src|type|pluginspage|width|height|autoplay],' .
    'param[name|value],' .
    'map[class|name|id],' .
    'area[shape|coords|href|target|alt],' . 
    'article[id|class|name|width|style],' .
    'section[id|class|name|width|style],' .
    'aside[id|class|name|width|style],' .
    'article[id|class|name|width|style],' .
    'ol[id|class|start|type]') ;

Use the format above to extend the editor to use any tags and tag attributes that you would like available to the editor. Above you see various tags and attributes being included, including HTML5 tags and attributes. You can include just the tags and attributes you believe you’ll need to support your use of the SilverStripe editor.

 

 

Leave a Reply