Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-09-01 18:12:43 +0300
committerJulien Veyssier <eneiluj@posteo.net>2022-09-15 19:05:52 +0300
commita3912e264a26d5ab3d042e6b47e7c75d2b123ada (patch)
tree94be27661eae4128713e824b9c1d595c1a3c437e /apps
parent79adca6b8b9b0be024899938f6e641c0379a14ed (diff)
change widget button api to support multiple button types
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps')
-rw-r--r--apps/dashboard/lib/Controller/DashboardApiController.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/apps/dashboard/lib/Controller/DashboardApiController.php b/apps/dashboard/lib/Controller/DashboardApiController.php
index f27a5ea0252..9f9872dc916 100644
--- a/apps/dashboard/lib/Controller/DashboardApiController.php
+++ b/apps/dashboard/lib/Controller/DashboardApiController.php
@@ -32,6 +32,7 @@ use OCP\Dashboard\IButtonWidget;
use OCP\Dashboard\IIconWidget;
use OCP\Dashboard\IManager;
use OCP\Dashboard\IWidget;
+use OCP\Dashboard\Model\WidgetButton;
use OCP\IConfig;
use OCP\IRequest;
@@ -114,11 +115,13 @@ class DashboardApiController extends OCSController {
];
if ($widget instanceof IButtonWidget) {
$data += [
- 'button' => [
- 'text' => $widget->getButtonText(),
- 'icon_url' => $widget->getButtonIconUrl(),
- 'url' => $widget->getUrl(),
- ],
+ 'buttons' => array_map(function(WidgetButton $button) {
+ return [
+ 'type' => $button->getType(),
+ 'text' => $button->getText(),
+ 'link' => $button->getLink(),
+ ];
+ }, $widget->getWidgetButtons($this->userId)),
];
}
return $data;