diff --git a/plugins/Favourite/Favourite.php b/plugins/Favourite/Favourite.php index a49dc13e66..2921debc6b 100644 --- a/plugins/Favourite/Favourite.php +++ b/plugins/Favourite/Favourite.php @@ -1,6 +1,7 @@ . + // }}} namespace Plugin\Favourite; @@ -75,7 +77,7 @@ class Favourite extends Plugin public function onInsertLeftPanelLink(string $user_nickname, &$res) { - $res .= Formatting::twigRender(<<Favourites Reverse Favs END, ['user_nickname' => $user_nickname]); diff --git a/src/Twig/Extension.php b/src/Twig/Extension.php index 811a67f057..1595c7b87a 100644 --- a/src/Twig/Extension.php +++ b/src/Twig/Extension.php @@ -55,7 +55,7 @@ class Extension extends AbstractExtension new TwigFunction('is_route', [Runtime::class, 'isCurrentRoute']), new TwigFunction('get_note_actions', [Runtime::class, 'getNoteActions']), new TwigFunction('get_note_other_content', [Runtime::class, 'getNoteOtherContent']), - new TwigFunction('get_show_styles', [Runtime::class, 'getShowStyles']), + new TwigFunction('show_stylesheets', [Runtime::class, 'getShowStylesheets']), new TwigFunction('handle_event', [Runtime::class, 'handleEvent']), new TwigFunction('config', [Runtime::class, 'getConfig']), new TwigFunction('icon', [Runtime::class, 'embedSvgIcon'], ['needs_environment' => true]), diff --git a/src/Twig/Runtime.php b/src/Twig/Runtime.php index 83235ac856..eeac1e66fc 100644 --- a/src/Twig/Runtime.php +++ b/src/Twig/Runtime.php @@ -1,7 +1,6 @@ . - // }}} /** @@ -95,16 +93,16 @@ class Runtime implements RuntimeExtensionInterface, EventSubscriberInterface * * @return array|mixed */ - public function getShowStyles() + public function getShowStylesheets() { $styles = []; - Event::handle('start_show_styles',[&$styles]); - return $styles; + Event::handle('ShowStyles', [&$styles]); + return implode("\n", $styles); } public function handleEvent(string $event, ...$args) { - $res = ''; + $res = []; $args[] = &$res; Event::handle($event, $args); return $res; diff --git a/templates/base.html.twig b/templates/base.html.twig index 020aba4a4c..4f6dfa7a47 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -14,10 +14,13 @@ - {% for stylesheet in get_show_styles() %} + {% for stylesheet in show_stylesheets() %} {% endfor %} {% endblock %} + {% for type, element in handle_event('ShowHeadElements', app.request) %} + <{{type}} rel="{{element['rel']}}" type="{{element['type']}}" href="{{element['href']}}" title="{{element['title']}}"> + {% endfor %} diff --git a/templates/left/left.html.twig b/templates/left/left.html.twig index 0a65046244..60ed89773c 100644 --- a/templates/left/left.html.twig +++ b/templates/left/left.html.twig @@ -44,7 +44,9 @@ Messages Replies - {{ handle_event('InsertLeftPanelLink', user_nickname) | raw }} + {% for link in handle_event('InsertLeftPanelLink', user_nickname) %} + {{ link | raw }} + {% endfor %} Settings Logout