Fix textarea HTML rendering and enforce light FilePond panels
This commit is contained in:
@@ -76,7 +76,7 @@ class OrganizationEditController extends AbstractFrontendModuleController
|
||||
'phone' => (string) ($organization['phone'] ?? ''),
|
||||
'email' => (string) ($organization['email'] ?? ''),
|
||||
'website' => (string) ($organization['website'] ?? ''),
|
||||
'description' => (string) ($organization['description'] ?? ''),
|
||||
'description' => $this->normalizeTextareaDescription((string) ($organization['description'] ?? '')),
|
||||
'tags' => $this->organizationRepository->getTagIdsForOrganization($organizationId),
|
||||
];
|
||||
|
||||
@@ -218,4 +218,14 @@ class OrganizationEditController extends AbstractFrontendModuleController
|
||||
|
||||
return $page instanceof PageModel ? $this->generateContentUrl($page) : '/';
|
||||
}
|
||||
|
||||
private function normalizeTextareaDescription(string $value): string
|
||||
{
|
||||
$decoded = html_entity_decode($value, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
||||
$decoded = preg_replace('/<\s*br\s*\/?>/i', "\n", $decoded) ?? $decoded;
|
||||
$decoded = preg_replace('/<\s*\/p\s*>\s*<\s*p[^>]*>/i', "\n\n", $decoded) ?? $decoded;
|
||||
$decoded = strip_tags($decoded);
|
||||
|
||||
return trim($decoded);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user