From 91e576d53097cbbc0a0619f1cb9bb1806ee69b9d Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 20 Nov 2015 15:17:38 +0100 Subject: [PATCH] lib: Add nl2br view helper refs #10603 --- library/Icinga/Web/View/helpers/string.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/Icinga/Web/View/helpers/string.php b/library/Icinga/Web/View/helpers/string.php index 1d79d885a..f1481be88 100644 --- a/library/Icinga/Web/View/helpers/string.php +++ b/library/Icinga/Web/View/helpers/string.php @@ -6,3 +6,7 @@ use Icinga\Util\String; $this->addHelperFunction('ellipsis', function ($string, $maxLength, $ellipsis = '...') { return String::ellipsis($string, $maxLength, $ellipsis); }); + +$this->addHelperFunction('nl2br', function ($string) { + return str_replace(array('\r\n', '\r', '\n'), '
', $string); +});