WidgetButton.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Dashboard\Model;
  8. /**
  9. * Button for a dashboard widget
  10. *
  11. * @since 25.0.0
  12. */
  13. class WidgetButton {
  14. /**
  15. * @since 25.0.0
  16. */
  17. public const TYPE_NEW = 'new';
  18. /**
  19. * @since 25.0.0
  20. */
  21. public const TYPE_MORE = 'more';
  22. /**
  23. * @since 25.0.0
  24. */
  25. public const TYPE_SETUP = 'setup';
  26. private string $type;
  27. private string $link;
  28. private string $text;
  29. /**
  30. * @param string $type
  31. * @param string $link
  32. * @param string $text
  33. * @since 25.0.0
  34. */
  35. public function __construct(string $type, string $link, string $text) {
  36. $this->type = $type;
  37. $this->link = $link;
  38. $this->text = $text;
  39. }
  40. /**
  41. * Get the button type, either "new", "more" or "setup"
  42. *
  43. * @return string
  44. * @since 25.0.0
  45. */
  46. public function getType(): string {
  47. return $this->type;
  48. }
  49. /**
  50. * Get the absolute url the buttons links to
  51. *
  52. * @return string
  53. * @since 25.0.0
  54. */
  55. public function getLink(): string {
  56. return $this->link;
  57. }
  58. /**
  59. * Get the translated text for the button
  60. *
  61. * @return string
  62. * @since 25.0.0
  63. */
  64. public function getText(): string {
  65. return $this->text;
  66. }
  67. }