HTML5 support for SilverStripe
- SilverStripe 4.0 or higher
For a SilverStripe 3.x compatible version of this module, please see the 1.0 branch, or 1.x release line.
This module adds further HTML 5 support to SilverStripe.
Although SilverStripe supports using HTML 5 in templates out of the box, there are some limitations in the use of HTML in the content managed through the CMS.
This module allows SilverStripe to support HTML 5 in HTMLText and HTMLVarchar fields, by providing a subclass of HTMLValue that uses the third party masterminds/html5-php library and causing the Injector to use this subclass by default.
SilverStripe stores HTMLText and HTMLVarchar fields in models as strings, but sometimes needs to convert these to DOM objects (for instance, to process shortcodes).
Default SilverStripe behavior is to do this with DOMDocument#loadHTML, but that method throws an error when it encounters the new HTML5 element types. It also doesn't deal with unclosed elements and invalid HTML in the manner prescribed by the HTML5 spec.
This module replaces the code that does this conversion with code that uses masterminds/html5-php library, which supports HTML 5 as per the spec.