LinkAction.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. /**
  3. * @copyright 2017 Christoph Wurst <christoph@winzerhof-wurst.at>
  4. *
  5. * @author Christoph Wurst <christoph@owncloud.com>
  6. *
  7. * @license GNU AGPL version 3 or any later version
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as
  11. * published by the Free Software Foundation, either version 3 of the
  12. * License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. namespace OC\Contacts\ContactsMenu\Actions;
  24. use OCP\Contacts\ContactsMenu\ILinkAction;
  25. class LinkAction implements ILinkAction {
  26. /** @var string */
  27. private $icon;
  28. /** @var string */
  29. private $name;
  30. /** @var string */
  31. private $href;
  32. /** @var int */
  33. private $priority = 10;
  34. /**
  35. * @param string $icon absolute URI to an icon
  36. */
  37. public function setIcon($icon) {
  38. $this->icon = $icon;
  39. }
  40. /**
  41. * @param string $name
  42. */
  43. public function setName($name) {
  44. $this->name = $name;
  45. }
  46. /**
  47. * @return string
  48. */
  49. public function getName() {
  50. return $this->name;
  51. }
  52. /**
  53. * @param int $priority
  54. */
  55. public function setPriority($priority) {
  56. $this->priority = $priority;
  57. }
  58. /**
  59. * @return int
  60. */
  61. public function getPriority() {
  62. return $this->priority;
  63. }
  64. /**
  65. * @param string $href
  66. */
  67. public function setHref($href) {
  68. $this->href = $href;
  69. }
  70. /**
  71. * @return string
  72. */
  73. public function getHref() {
  74. return $this->href;
  75. }
  76. /**
  77. * @return array
  78. */
  79. public function jsonSerialize() {
  80. return [
  81. 'title' => $this->name,
  82. 'icon' => $this->icon,
  83. 'hyperlink' => $this->href,
  84. ];
  85. }
  86. }