1
0

IWidget.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Dashboard;
  8. /**
  9. * Interface IWidget
  10. *
  11. * @since 20.0.0
  12. */
  13. interface IWidget {
  14. /**
  15. * Get a unique identifier for the widget
  16. *
  17. * To ensure uniqueness, it is recommended to user the app id or start with the
  18. * app id followed by a dash.
  19. *
  20. * @return string Unique id that identifies the widget, e.g. the app id. Only use alphanumeric characters, dash and underscore
  21. * @since 20.0.0
  22. */
  23. public function getId(): string;
  24. /**
  25. * @return string User facing title of the widget
  26. * @since 20.0.0
  27. */
  28. public function getTitle(): string;
  29. /**
  30. * @return int Initial order for widget sorting
  31. * @since 20.0.0
  32. */
  33. public function getOrder(): int;
  34. /**
  35. * CSS class that shows the widget icon (should be colored black or not have a color)
  36. *
  37. * The icon will be inverted automatically in mobile clients and when using dark mode.
  38. * Therefore, it is NOT recommended to use a css class that sets the background with:
  39. * `var(--icon-…)` as those will adapt to dark/bright mode in the web and still be inverted
  40. * resulting in a dark icon on dark background.
  41. *
  42. * @return string css class that displays an icon next to the widget title
  43. * @since 20.0.0
  44. */
  45. public function getIconClass(): string;
  46. /**
  47. * @return string|null The absolute url to the apps own view
  48. * @since 20.0.0
  49. */
  50. public function getUrl(): ?string;
  51. /**
  52. * Execute widget bootstrap code like loading scripts and providing initial state
  53. * @since 20.0.0
  54. */
  55. public function load(): void;
  56. }