rcrowe / TwigBridge

Give the power of Twig to Laravel
MIT License
894 stars 168 forks source link

Add ability to specify safe classes for escaper #387

Closed mbardelmeijer closed 4 years ago

mbardelmeijer commented 4 years ago

Reasoning: Laravel provides a handy HtmlString that implements the Htmlable interface. If a function in the twig template is called and such a object is returned, it should not escape the HTML.

Twig provides a handy setSafeClass method on the EscaperExtension class which is enabled by default. This PR adds the ability to define custom safe classes in the config item. By default, we set the sensable Htmlable with the ['html'] strategy.

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.4%) to 54.482% when pulling e1a2fc354477f186c06c2f6de4e235e97b8bae15 on mbardelmeijer:safeClasses into b8bd5db744d51adb11623547f281dfaf5ac60230 on rcrowe:master.

coveralls commented 4 years ago

Coverage Status

Coverage decreased (-0.4%) to 54.418% when pulling e1a2fc354477f186c06c2f6de4e235e97b8bae15 on mbardelmeijer:safeClasses into b8bd5db744d51adb11623547f281dfaf5ac60230 on rcrowe:master.