From 12210d0fb07ccc83b1297459ca849826cb126df4 Mon Sep 17 00:00:00 2001 From: Maxim Leshchenko Date: Fri, 20 May 2022 13:45:14 +0100 Subject: [PATCH] Groups: Allow line breaks in descriptions Closes #542 --- Web/Models/Entities/Club.php | 6 ++++++ Web/Presenters/templates/Group/View.xml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Web/Models/Entities/Club.php b/Web/Models/Entities/Club.php index 7097ca15..96daff04 100644 --- a/Web/Models/Entities/Club.php +++ b/Web/Models/Entities/Club.php @@ -99,6 +99,12 @@ class Club extends RowModel { return $this->getRecord()->about; } + + function getDescriptionHtml(): ?string + { + if(!is_null($this->getDescription())) + return nl2br(htmlspecialchars($this->getDescription(), ENT_DISALLOWED | ENT_XHTML)); + } function getShortCode(): ?string { diff --git a/Web/Presenters/templates/Group/View.xml b/Web/Presenters/templates/Group/View.xml index 5e9acaac..b68fcd2b 100644 --- a/Web/Presenters/templates/Group/View.xml +++ b/Web/Presenters/templates/Group/View.xml @@ -29,7 +29,7 @@ {_"description"}: - {$club->getDescription()} + {$club->getDescriptionHtml()|noescape} {_"website"}: