IWidgetConfig.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * Nextcloud - Dashboard App
  5. *
  6. * This file is licensed under the Affero General Public License version 3 or
  7. * later. See the COPYING file.
  8. *
  9. * @author Maxence Lange <maxence@artificial-owl.com>
  10. * @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
  11. * @license GNU AGPL version 3 or any later version
  12. *
  13. * This program is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License as
  15. * published by the Free Software Foundation, either version 3 of the
  16. * License, or (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  25. *
  26. */
  27. namespace OCP\Dashboard\Model;
  28. use OCP\Dashboard\IDashboardWidget;
  29. /**
  30. * Interface IWidgetConfig
  31. *
  32. * This object contains the configuration of a widget for a userId
  33. *
  34. * @see IDashboardWidget::loadWidget
  35. *
  36. * @since 15.0.0
  37. *
  38. * @package OCP\Dashboard\Model
  39. */
  40. interface IWidgetConfig {
  41. /**
  42. * Returns the userId
  43. *
  44. * @since 15.0.0
  45. *
  46. * @return string
  47. */
  48. public function getUserId(): string;
  49. /**
  50. * Returns the widgetId
  51. *
  52. * @since 15.0.0
  53. *
  54. * @return string
  55. */
  56. public function getWidgetId(): string;
  57. /**
  58. * Returns the current position and the current size of the widget as
  59. * displayed on the user's dashboard
  60. *
  61. * The returned value is an array:
  62. * [
  63. * 'x' => (int) position on the X axis,
  64. * 'y' => (int) position on the Y axis,
  65. * 'width' => (int) width of the widget,
  66. * 'height' => (int) height of the widget
  67. * ]
  68. *
  69. * @since 15.0.0
  70. *
  71. * @return array
  72. */
  73. public function getPosition(): array;
  74. /**
  75. * Returns an array with the settings defined by the user for the widget.
  76. * The returned value is an array, with setting used as keys:
  77. *
  78. * [
  79. * 'setting1' => 'any value',
  80. * 'setting2' => 'other value'
  81. * ]
  82. *
  83. * Each setting that can be edited by a user should be defined in a
  84. * WidgetSetting.
  85. *
  86. * @see WidgetSetting
  87. *
  88. * Those WidgetSetting are in the WidgetTemplate defined during the setup
  89. * of the widget in the IDashboardWidget.
  90. *
  91. * @see IDashboardWidget::getWidgetTemplate
  92. * @see WidgetTemplate
  93. *
  94. * When using this framework, the settings interface is generated by the
  95. * Dashboard app.
  96. *
  97. * @since 15.0.0
  98. *
  99. * @return array
  100. */
  101. public function getSettings(): array;
  102. /**
  103. * Returns if the widget is enabled/displayed in this user's dashboard.
  104. *
  105. * @since 15.0.0
  106. *
  107. * @return bool
  108. */
  109. public function isEnabled(): bool;
  110. }