ActionFactory.php 872 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OC\Contacts\ContactsMenu;
  7. use OC\Contacts\ContactsMenu\Actions\LinkAction;
  8. use OCP\Contacts\ContactsMenu\IActionFactory;
  9. use OCP\Contacts\ContactsMenu\ILinkAction;
  10. class ActionFactory implements IActionFactory {
  11. /**
  12. * {@inheritDoc}
  13. */
  14. public function newLinkAction(string $icon, string $name, string $href, string $appId = ''): ILinkAction {
  15. $action = new LinkAction();
  16. $action->setName($name);
  17. $action->setIcon($icon);
  18. $action->setHref($href);
  19. $action->setAppId($appId);
  20. return $action;
  21. }
  22. /**
  23. * {@inheritDoc}
  24. */
  25. public function newEMailAction(string $icon, string $name, string $email, string $appId = ''): ILinkAction {
  26. return $this->newLinkAction($icon, $name, 'mailto:' . $email, $appId);
  27. }
  28. }