LinkMenuAction.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCP\AppFramework\Http\Template;
  7. use OCP\Util;
  8. /**
  9. * Class LinkMenuAction
  10. *
  11. * @since 14.0.0
  12. */
  13. class LinkMenuAction extends SimpleMenuAction {
  14. /**
  15. * LinkMenuAction constructor.
  16. *
  17. * @param string $label
  18. * @param string $icon
  19. * @param string $link
  20. * @since 14.0.0
  21. */
  22. public function __construct(string $label, string $icon, string $link) {
  23. parent::__construct('directLink-container', $label, $icon, $link);
  24. }
  25. /**
  26. * @return string
  27. * @since 14.0.0
  28. */
  29. public function render(): string {
  30. return '<li>' .
  31. '<a id="directLink-container">' .
  32. '<span class="icon ' . Util::sanitizeHTML($this->getIcon()) . '"></span>' .
  33. '<label for="directLink">' . Util::sanitizeHTML($this->getLabel()) . '</label>' .
  34. '</a>' .
  35. '</li>' .
  36. '<li>' .
  37. '<span class="menuitem">' .
  38. '<input id="directLink" type="text" readonly="" value="' . Util::sanitizeHTML($this->getLink()) . '">' .
  39. '</span>' .
  40. '</li>';
  41. }
  42. }