diff --git a/api/src/Etemplate/Widget/Link.php b/api/src/Etemplate/Widget/Link.php index 021adf1b25..c208aaea09 100644 --- a/api/src/Etemplate/Widget/Link.php +++ b/api/src/Etemplate/Widget/Link.php @@ -13,6 +13,7 @@ namespace EGroupware\Api\Etemplate\Widget; +use InvalidArgumentException; use EGroupware\Api\Etemplate; use EGroupware\Api; @@ -310,8 +311,19 @@ class Link extends Etemplate\Widget $response->message(lang('%1 files copied',count($copied))); } - public static function ajax_delete($value) + /** + * Delete a link specified by its link_id + * + * @param int $value link_id to delete + * @return void + * @throws Api\Json\Exception|InvalidArgumentException + */ + public static function ajax_delete(int $value) { + if ($value <= 0) + { + throw new InvalidArgumentException(); + } $response = Api\Json\Response::get(); $response->data(Api\Link::unlink($value)); } @@ -430,4 +442,4 @@ class Link extends Etemplate\Widget //error_log(" " . array2string($valid)); } } -} +} \ No newline at end of file