2
votes

I have a simple SilverStripe ( v3.1 ) page that is being managed in the CMS.

My goal is to dump some HTML into the content field using the html feature and have the page render the content as I need it.

The problem is the HTMLEditorField seems to strip out all HTML5 tags such as <nav> which I need for the site I am converting.

I have read about the issue here: http://www.silverstripe.org/community/forums/customising-the-cms/show/69101

And tried each of the solutions and flushed the cache with no results. This is not surprising as most of the people in the thread have the same result.

I also tried this module: https://github.com/silverstripe/silverstripe-html5

With the same results. No change.

Is it possible to enable HTML5 tags easily with a configuration option and without modifying the framework or CMS code? If so is there an example of this online?

All resources, comments, links and solutions are apreciated.

Cheers.

1

1 Answers

3
votes

In SilverStripe 3.1 calling setOption('extended_valid_elements', ...) in mysite/_config.php works for me:

HtmlEditorConfig::get('cms')->setOption(
    'extended_valid_elements',
    'img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|usemap|data*],'
        . 'iframe[src|name|width|height|align|frameborder|marginwidth|marginheight|scrolling],'
        . 'object[width|height|data|type],'
        . 'embed[src|type|pluginspage|width|height|autoplay],'
        . 'param[name|value],'
        . 'map[class|name|id],'
        . 'area[shape|coords|href|target|alt],'
        . 'ol[start|type]'
        . 'address[class|name|id],'
        . 'article[class|name|id],'
        . 'aside[class|name|id],'
        . 'audio[class|name|id],'
        . 'bdi[class|name|id],'
        . 'caption[class|name|id],'
        . 'canvas[class|name|id],'
        . 'datalist[class|name|id],'
        . 'details[class|name|id],'
        . 'dialog[class|name|id],'
        . 'embed[class|name|id],'
        . 'figure[class|name|id],'
        . 'figcaption[class|name|id],'
        . 'footer[class|name|id],'
        . 'header[class|name|id],'
        . 'keygen[class|name|id],'
        . 'mark[class|name|id],'
        . 'menuitem[class|name|id],'
        . 'meter[class|name|id],'
        . 'nav[class|name|id],'
        . 'output[class|name|id],'
        . 'progress[class|name|id],'
        . 'rp[class|name|id],'
        . 'rt[class|name|id],'
        . 'ruby[class|name|id],'
        . 'section[class|name|id],'
        . 'source[class|name|id],'
        . 'summary[class|name|id],'
        . 'time[class|name|id],'
        . 'track[class|name|id],'
        . 'video[class|name|id],'
        . 'wbr[class|name|id]'
);