aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/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 /lib/public/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 'lib/public/Dashboard')
-rw-r--r--lib/public/Dashboard/IOptionWidget.php (renamed from lib/public/Dashboard/IItemOptionWidget.php)10
-rw-r--r--lib/public/Dashboard/Model/WidgetButton.php6
-rw-r--r--lib/public/Dashboard/Model/WidgetOptions.php61
3 files changed, 69 insertions, 8 deletions
diff --git a/lib/public/Dashboard/IItemOptionWidget.php b/lib/public/Dashboard/IOptionWidget.php
index 9826286b041..0cc129a5087 100644
--- a/lib/public/Dashboard/IItemOptionWidget.php
+++ b/lib/public/Dashboard/IOptionWidget.php
@@ -22,16 +22,16 @@ declare(strict_types=1);
*/
namespace OCP\Dashboard;
+use OCP\Dashboard\Model\WidgetOptions;
+
/**
* Allow getting widget options
*
* @since 25.0.0
*/
-interface IItemOptionWidget extends IWidget {
+interface IOptionWidget extends IWidget {
/**
- * Should the item icons be rendered round (or raw/square) by the clients?
- *
- * @return bool
+ * Get additional options for the widget
*/
- public function getItemIconsRound(): bool;
+ public function getWidgetOptions(): WidgetOptions;
}
diff --git a/lib/public/Dashboard/Model/WidgetButton.php b/lib/public/Dashboard/Model/WidgetButton.php
index c56ab232963..f3e706bf652 100644
--- a/lib/public/Dashboard/Model/WidgetButton.php
+++ b/lib/public/Dashboard/Model/WidgetButton.php
@@ -29,9 +29,9 @@ namespace OCP\Dashboard\Model;
* @since 25.0.0
*/
class WidgetButton {
- const TYPE_NEW = 'new';
- const TYPE_MORE = 'more';
- const TYPE_SETUP = 'setup';
+ public const TYPE_NEW = 'new';
+ public const TYPE_MORE = 'more';
+ public const TYPE_SETUP = 'setup';
private string $type;
private string $link;
diff --git a/lib/public/Dashboard/Model/WidgetOptions.php b/lib/public/Dashboard/Model/WidgetOptions.php
new file mode 100644
index 00000000000..44efdbda457
--- /dev/null
+++ b/lib/public/Dashboard/Model/WidgetOptions.php
@@ -0,0 +1,61 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2022 Robin Appelman <robin@icewind.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\Dashboard\Model;
+
+/**
+ * Option for displaying a widget
+ *
+ * @since 25.0.0
+ */
+class WidgetOptions {
+ private bool $roundItemIcons;
+
+ /**
+ * @param bool $roundItemIcons
+ * @since 25.0.0
+ */
+ public function __construct(bool $roundItemIcons) {
+ $this->roundItemIcons = $roundItemIcons;
+ }
+
+ /**
+ * Get the default set of options
+ *
+ * @return WidgetOptions
+ * @since 25.0.0
+ */
+ public static function getDefault(): WidgetOptions {
+ return new WidgetOptions(false);
+ }
+
+ /**
+ * Whether the clients should render icons for widget items as round icons
+ *
+ * @return bool
+ * @since 25.0.0
+ */
+ public function withRoundItemIcons(): bool {
+ return $this->roundItemIcons;
+ }
+}