-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(contacts-menu): implement custom javascript hook action
Signed-off-by: Richard Steinmetz <[email protected]>
- Loading branch information
Showing
5 changed files
with
136 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
lib/private/Contacts/ContactsMenu/Actions/JavascriptAction.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
namespace OC\Contacts\ContactsMenu\Actions; | ||
|
||
use OCP\Contacts\ContactsMenu\IAction; | ||
|
||
/** | ||
* @since 31.0.0 | ||
*/ | ||
class JavascriptAction implements IAction { | ||
public const TYPE = 'JavascriptAction'; | ||
|
||
private string $icon = ''; | ||
private string $name = ''; | ||
private int $priority = 10; | ||
private string $appId = ''; | ||
private string $hook = ''; | ||
|
||
public function setIcon(string $icon) { | ||
$this->icon = $icon; | ||
} | ||
|
||
public function getName(): string { | ||
return $this->name; | ||
} | ||
|
||
public function setName(string $name) { | ||
$this->name = $name; | ||
} | ||
|
||
public function setPriority(int $priority) { | ||
$this->priority = $priority; | ||
} | ||
|
||
public function getPriority(): int { | ||
return $this->priority; | ||
} | ||
|
||
public function setAppId(string $appId) { | ||
$this->appId = $appId; | ||
} | ||
|
||
public function getAppId(): string { | ||
return $this->appId; | ||
} | ||
|
||
public function getHook(): string { | ||
return $this->hook; | ||
} | ||
|
||
public function setHook(string $hook): void { | ||
$this->hook = $hook; | ||
} | ||
|
||
function jsonSerialize() { | ||
Check failure on line 62 in lib/private/Contacts/ContactsMenu/Actions/JavascriptAction.php GitHub Actions / static-code-analysisMethodSignatureMustProvideReturnType
|
||
return [ | ||
'type' => self::TYPE, | ||
'title' => $this->name, | ||
'icon' => $this->icon, | ||
'appId' => $this->appId, | ||
'hook' => $this->hook, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters