Skip to content

Commit

Permalink
Use improved dashboard widget api to register reviews widget as a dat…
Browse files Browse the repository at this point in the history
…aset on chart widget

Signed-off-by: Sam <[email protected]>
  • Loading branch information
sampoyigi committed Jun 6, 2023
1 parent 6548da3 commit cab177a
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,18 +240,17 @@ protected function registerOrderTypes()

protected function extendDashboardChartsDatasets()
{
Event::listen('admin.charts.extendDatasets', function ($widget) {
if (!$widget instanceof Charts)
return;

Charts::registertsDatase(function () {
if (!ReviewSettings::get('allow_reviews', false))
return;

$widget->contextDefinitions['reviews'] = [
'label' => 'lang:igniter.local::default.reviews.text_title',
'color' => '#FFB74D',
'model' => Reviews_model::class,
'column' => 'created_at',
return [];

return [
'reviews' => [
'label' => 'lang:igniter.local::default.reviews.text_title',
'color' => '#FFB74D',
'model' => Reviews_model::class,
'column' => 'created_at',
],
];
});
}
Expand Down Expand Up @@ -323,8 +322,7 @@ protected function bindRememberLocationAreaEvents(): void
if ($areaId && $area = Location_areas_model::find($areaId)) {
LocationFacade::updateNearbyArea($area);
}
}
catch (\Exception $exception) {
} catch (\Exception $exception) {
}
});
}
Expand Down

0 comments on commit cab177a

Please sign in to comment.