Skip to content

Commit

Permalink
Add callbacks to dashboard portlet rendering
Browse files Browse the repository at this point in the history
In some cases, we might want to change portlet attributes
before rendering it, or even update HasResults attribute
after the portlet has been rendered.

This patch adds callbacks before and after rendering
portlets.
  • Loading branch information
richieri-bps committed Feb 22, 2024
1 parent 2f3797b commit c08d36b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions share/html/Dashboards/Elements/ShowPortlet/dashboard
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ Abort("Possible recursive dashboard detected.") if $Depth > 8;
<%perl>
local $session{CurrentUser} = $session{ContextUser};
for my $portlet (@panes) {

$m->callback(CallbackName => 'BeforeComponent', Dashboard => $Dashboard,
HasResults => $HasResults, Portlet => $portlet, ARGSRef => \%ARGS);

$m->comp($portlet->{portlet_type},
Portlet => $portlet,
Rows => $Rows,
Expand All @@ -86,6 +90,10 @@ for my $portlet (@panes) {
Depth => $Depth + 1,
HasResults => $HasResults
);

$m->callback(CallbackName => 'AfterComponent', Dashboard => $Dashboard,
HasResults => $HasResults, Portlet => $portlet, ARGSRef => \%ARGS);

}
</%perl>

0 comments on commit c08d36b

Please sign in to comment.