From 63f9c6341e4f902ce64165a028cb123b9e2754d4 Mon Sep 17 00:00:00 2001 From: Phablulo Date: Thu, 23 Dec 2021 21:37:35 -0300 Subject: [PATCH] [COMPONENT][RightPanel] Sends request object in the `AppendRightPanelBlock` event --- components/RightPanel/templates/right_panel/view.html.twig | 2 +- docs/developer/src/templates.md | 4 ++-- plugins/AttachmentShowRelated/AttachmentShowRelated.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/RightPanel/templates/right_panel/view.html.twig b/components/RightPanel/templates/right_panel/view.html.twig index 5c96fbc024..f4b72e652f 100644 --- a/components/RightPanel/templates/right_panel/view.html.twig +++ b/components/RightPanel/templates/right_panel/view.html.twig @@ -46,7 +46,7 @@ {% endif %} {% set current_path = app.request.get('_route') %} - {% for block in handle_event('AppendRightPanelBlock', {'path': current_path, 'vars': right_panel_vars | default }) %} + {% for block in handle_event('AppendRightPanelBlock', {'path': current_path, 'vars': right_panel_vars | default }, request) %} {{ block | raw }} {% endfor %} diff --git a/docs/developer/src/templates.md b/docs/developer/src/templates.md index a9447c77e8..e9ac1278cb 100644 --- a/docs/developer/src/templates.md +++ b/docs/developer/src/templates.md @@ -9,7 +9,7 @@ Example ------- ```php -public function onAppendRightPanelBlock(array $vars, array &$res): bool +public function onAppendRightPanelBlock(array $vars, Request $request, array &$res): bool { if ($vars['path'] == 'attachment_show') { $related_notes = DB::dql('select n from attachment_to_note an ' . @@ -26,4 +26,4 @@ public function onAppendRightPanelBlock(array $vars, array &$res): bool ``` Regarding using the Twig language, you can refer to -[Twig Documentation](https://twig.symfony.com/doc/3.x/templates.html). \ No newline at end of file +[Twig Documentation](https://twig.symfony.com/doc/3.x/templates.html). diff --git a/plugins/AttachmentShowRelated/AttachmentShowRelated.php b/plugins/AttachmentShowRelated/AttachmentShowRelated.php index 533fbe342b..df6f9883a5 100644 --- a/plugins/AttachmentShowRelated/AttachmentShowRelated.php +++ b/plugins/AttachmentShowRelated/AttachmentShowRelated.php @@ -31,7 +31,7 @@ use App\Util\Formatting; class AttachmentShowRelated extends Plugin { - public function onAppendRightPanelBlock($vars, &$res): bool + public function onAppendRightPanelBlock($vars, $request, &$res): bool { if ($vars['path'] === 'attachment_show') { $related_notes = DB::dql('select n from attachment_to_note an '