2017-01-24 01:47:14 -05:00
|
|
|
<?php
|
|
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2017-01-24 01:47:14 -05:00
|
|
|
*/
|
|
|
|
|
namespace OC\Contacts\ContactsMenu\Actions;
|
|
|
|
|
|
|
|
|
|
use OCP\Contacts\ContactsMenu\ILinkAction;
|
|
|
|
|
|
|
|
|
|
class LinkAction implements ILinkAction {
|
2022-03-22 07:39:23 -04:00
|
|
|
private string $icon = '';
|
|
|
|
|
private string $name = '';
|
|
|
|
|
private string $href = '';
|
|
|
|
|
private int $priority = 10;
|
|
|
|
|
private string $appId = '';
|
2021-10-18 12:19:37 -04:00
|
|
|
|
2017-01-24 01:47:14 -05:00
|
|
|
/**
|
|
|
|
|
* @param string $icon absolute URI to an icon
|
|
|
|
|
*/
|
2023-06-25 04:26:58 -04:00
|
|
|
public function setIcon(string $icon): void {
|
2017-01-24 01:47:14 -05:00
|
|
|
$this->icon = $icon;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-25 04:26:58 -04:00
|
|
|
public function setName(string $name): void {
|
2017-01-24 01:47:14 -05:00
|
|
|
$this->name = $name;
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-22 07:39:23 -04:00
|
|
|
public function getName(): string {
|
2017-01-24 01:47:14 -05:00
|
|
|
return $this->name;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-25 04:26:58 -04:00
|
|
|
public function setPriority(int $priority): void {
|
2017-01-24 01:47:14 -05:00
|
|
|
$this->priority = $priority;
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-22 07:39:23 -04:00
|
|
|
public function getPriority(): int {
|
2017-01-24 01:47:14 -05:00
|
|
|
return $this->priority;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-25 04:26:58 -04:00
|
|
|
public function setHref(string $href): void {
|
2017-01-24 01:47:14 -05:00
|
|
|
$this->href = $href;
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-22 07:39:23 -04:00
|
|
|
public function getHref(): string {
|
2017-01-24 01:47:14 -05:00
|
|
|
return $this->href;
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-18 12:19:37 -04:00
|
|
|
/**
|
|
|
|
|
* @since 23.0.0
|
|
|
|
|
*/
|
2023-06-25 04:26:58 -04:00
|
|
|
public function setAppId(string $appId): void {
|
2021-10-20 08:43:45 -04:00
|
|
|
$this->appId = $appId;
|
2021-10-18 12:19:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @since 23.0.0
|
|
|
|
|
*/
|
2021-10-20 08:43:45 -04:00
|
|
|
public function getAppId(): string {
|
|
|
|
|
return $this->appId;
|
2021-10-18 12:19:37 -04:00
|
|
|
}
|
|
|
|
|
|
2023-03-15 12:29:32 -04:00
|
|
|
/**
|
|
|
|
|
* @return array{title: string, icon: string, hyperlink: string, appId: string}
|
|
|
|
|
*/
|
2021-10-19 11:11:53 -04:00
|
|
|
public function jsonSerialize(): array {
|
2017-01-24 01:47:14 -05:00
|
|
|
return [
|
|
|
|
|
'title' => $this->name,
|
|
|
|
|
'icon' => $this->icon,
|
|
|
|
|
'hyperlink' => $this->href,
|
2021-10-20 08:43:45 -04:00
|
|
|
'appId' => $this->appId,
|
2017-01-24 01:47:14 -05:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|