[COMPONENT][RightPanel] Sends request object in the `AppendRightPanelBlock` event

This commit is contained in:
Phablulo Joel 2021-12-23 21:37:35 -03:00
parent 1947e99430
commit 63f9c6341e
3 changed files with 4 additions and 4 deletions

View File

@ -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 %}

View File

@ -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).
[Twig Documentation](https://twig.symfony.com/doc/3.x/templates.html).

View File

@ -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 '