summaryrefslogtreecommitdiffstats
path: root/apps/dashboard
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-09-13 13:03:35 +0200
committerJulien Veyssier <eneiluj@posteo.net>2022-09-15 18:06:21 +0200
commitd9e75f00b1977da7325db14554729419f5fe02c9 (patch)
tree6126ee5c6ff5528d6852f525de4e7a4294db6edd /apps/dashboard
parent845149bb7ccba5f0de37d145c6b7d13a7532e68b (diff)
downloadnextcloud-server-d9e75f00b1977da7325db14554729419f5fe02c9.tar.gz
nextcloud-server-d9e75f00b1977da7325db14554729419f5fe02c9.zip
move widget options into a Option class
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/dashboard')
-rw-r--r--apps/dashboard/lib/Controller/DashboardApiController.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/apps/dashboard/lib/Controller/DashboardApiController.php b/apps/dashboard/lib/Controller/DashboardApiController.php
index b0859a088c6..f7a1d6961c2 100644
--- a/apps/dashboard/lib/Controller/DashboardApiController.php
+++ b/apps/dashboard/lib/Controller/DashboardApiController.php
@@ -30,10 +30,11 @@ use OCP\AppFramework\OCSController;
use OCP\AppFramework\Http\DataResponse;
use OCP\Dashboard\IButtonWidget;
use OCP\Dashboard\IIconWidget;
-use OCP\Dashboard\IItemOptionWidget;
+use OCP\Dashboard\IOptionWidget;
use OCP\Dashboard\IManager;
use OCP\Dashboard\IWidget;
use OCP\Dashboard\Model\WidgetButton;
+use OCP\Dashboard\Model\WidgetOptions;
use OCP\IConfig;
use OCP\IRequest;
@@ -106,6 +107,7 @@ class DashboardApiController extends OCSController {
$widgets = $this->dashboardManager->getWidgets();
$items = array_map(function (IWidget $widget) {
+ $options = ($widget instanceof IOptionWidget) ? $widget->getWidgetOptions() : WidgetOptions::getDefault();
$data = [
'id' => $widget->getId(),
'title' => $widget->getTitle(),
@@ -113,11 +115,11 @@ class DashboardApiController extends OCSController {
'icon_class' => $widget->getIconClass(),
'icon_url' => ($widget instanceof IIconWidget) ? $widget->getIconUrl() : '',
'widget_url' => $widget->getUrl(),
- 'item_icons_round' => ($widget instanceof IItemOptionWidget) ? $widget->getItemIconsRound() : false,
+ 'item_icons_round' => $options->withRoundItemIcons(),
];
if ($widget instanceof IButtonWidget) {
$data += [
- 'buttons' => array_map(function(WidgetButton $button) {
+ 'buttons' => array_map(function (WidgetButton $button) {
return [
'type' => $button->getType(),
'text' => $button->getText(),