1
0

WidgetButton.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. /**
  30. * @since 25.0.0
  31. */
  32. public const TYPE_NEW = 'new';
  33. /**
  34. * @since 25.0.0
  35. */
  36. public const TYPE_MORE = 'more';
  37. /**
  38. * @since 25.0.0
  39. */
  40. public const TYPE_SETUP = 'setup';
  41. private string $type;
  42. private string $link;
  43. private string $text;
  44. /**
  45. * @param string $type
  46. * @param string $link
  47. * @param string $text
  48. * @since 25.0.0
  49. */
  50. public function __construct(string $type, string $link, string $text) {
  51. $this->type = $type;
  52. $this->link = $link;
  53. $this->text = $text;
  54. }
  55. /**
  56. * Get the button type, either "new", "more" or "setup"
  57. *
  58. * @return string
  59. * @since 25.0.0
  60. */
  61. public function getType(): string {
  62. return $this->type;
  63. }
  64. /**
  65. * Get the absolute url the buttons links to
  66. *
  67. * @return string
  68. * @since 25.0.0
  69. */
  70. public function getLink(): string {
  71. return $this->link;
  72. }
  73. /**
  74. * Get the translated text for the button
  75. *
  76. * @return string
  77. * @since 25.0.0
  78. */
  79. public function getText(): string {
  80. return $this->text;
  81. }
  82. }