1
0

WidgetButton.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2022 Robin Appelman <robin@icewind.nl>
  5. *
  6. * @license GNU AGPL version 3 or any later version
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License as
  10. * published by the Free Software Foundation, either version 3 of the
  11. * License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. namespace OCP\Dashboard\Model;
  23. /**
  24. * Button for a dashboard widget
  25. *
  26. * @since 25.0.0
  27. */
  28. class WidgetButton {
  29. public const TYPE_NEW = 'new';
  30. public const TYPE_MORE = 'more';
  31. public const TYPE_SETUP = 'setup';
  32. private string $type;
  33. private string $link;
  34. private string $text;
  35. /**
  36. * @param string $type
  37. * @param string $link
  38. * @param string $text
  39. * @since 25.0.0
  40. */
  41. public function __construct(string $type, string $link, string $text) {
  42. $this->type = $type;
  43. $this->link = $link;
  44. $this->text = $text;
  45. }
  46. /**
  47. * Get the button type, either "new", "more" or "setup"
  48. *
  49. * @return string
  50. * @since 25.0.0
  51. */
  52. public function getType(): string {
  53. return $this->type;
  54. }
  55. /**
  56. * Get the absolute url the buttons links to
  57. *
  58. * @return string
  59. * @since 25.0.0
  60. */
  61. public function getLink(): string {
  62. return $this->link;
  63. }
  64. /**
  65. * Get the translated text for the button
  66. *
  67. * @return string
  68. * @since 25.0.0
  69. */
  70. public function getText(): string {
  71. return $this->text;
  72. }
  73. }