Search code examples
modxmodx-revolution

Set Modx Revolution :nl2br to Output HTML


Is there a way to set Modx Revolution to output HTML <br>s using the :nlb2r output filter rather than XHTML <br />s through a system setting?


Solution

  • Just create custom snippet - http://rtfm.modx.com/display/revolution20/Input+and+Output+Filters+%28Output+Modifiers%29 , as example:

    <?php
    $mode = !empty($options) ? true : false;
    return nl2br($input, $mode);
    

    This filter does not depend on the system settings, he is located in the code modx- https://github.com/modxcms/revolution/blob/develop/core/model/modx/filters/modoutputfilter.class.php#L431 so you need to create custom snippet.