['all']]), new TwigFunction('showScriptTags', [$this, 'showScriptTags'], ['is_safe' => ['all']]), new TwigFunction('getSortedEditorFonts', [$this, 'sortEditorFonts']), ]; } /** * Dispatch an event to collect custom content. * * @param ?mixed $context Context of the content requested for the viewName * @param array $vars twig vars * @param ?string $viewName The main identifier for the content requested. Will be etracted from $vars if get_defined */ public function getCustomContent($context = null, array $vars = [], ?string $viewName = null): string { return $this->contentHelper->getCustomContent($context, $vars, $viewName); } /** * Replaces HTML script tags with non HTML tags so the JS inside them won't * execute and will be readable. */ public function showScriptTags(string $html): string { return $this->contentHelper->showScriptTags($html); } /** * @param array $fonts * * @return array */ public function sortEditorFonts(array $fonts): array { usort($fonts, static function ($fontA, $fontB): int { $fontAName = $fontA['name'] ?? ''; $fontBName = $fontB['name'] ?? ''; return strcasecmp($fontAName, $fontBName); }); return $fonts; } }