diff options
Diffstat (limited to 'lib/public/Files/Template/TemplateFileCreator.php')
-rw-r--r-- | lib/public/Files/Template/TemplateFileCreator.php | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/lib/public/Files/Template/TemplateFileCreator.php b/lib/public/Files/Template/TemplateFileCreator.php index 26edf585869..809bd3d0bc2 100644 --- a/lib/public/Files/Template/TemplateFileCreator.php +++ b/lib/public/Files/Template/TemplateFileCreator.php @@ -3,26 +3,8 @@ declare(strict_types=1); /** - * @copyright Copyright (c) 2021 Julius Härtl <jus@bitgrid.net> - * - * @author John Molakvoæ <skjnldsv@protonmail.com> - * @author Julius Härtl <jus@bitgrid.net> - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * + * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later */ namespace OCP\Files\Template; @@ -31,18 +13,28 @@ namespace OCP\Files\Template; */ final class TemplateFileCreator implements \JsonSerializable { protected $appId; + /** @var list<string> $mimetypes */ protected $mimetypes = []; protected $actionName; protected $fileExtension; + /** @var ?string $iconClass */ protected $iconClass; + /** @var ?string $iconSvgInline */ + protected $iconSvgInline; + /** @var ?float $ratio */ protected $ratio = null; protected $order = 100; + /** + * @since 27.0.0 + * @deprecated 28.0.0 + */ + protected string $actionLabel = ''; /** * @since 21.0.0 */ public function __construct( - string $appId, string $actionName, string $fileExtension + string $appId, string $actionName, string $fileExtension, ) { $this->appId = $appId; $this->actionName = $actionName; @@ -58,6 +50,7 @@ final class TemplateFileCreator implements \JsonSerializable { /** * @since 21.0.0 + * @deprecated 29.0.0 */ public function setIconClass(string $iconClass): TemplateFileCreator { $this->iconClass = $iconClass; @@ -65,6 +58,14 @@ final class TemplateFileCreator implements \JsonSerializable { } /** + * @since 29.0.0 + */ + public function setIconSvgInline(string $iconSvgInline): TemplateFileCreator { + $this->iconSvgInline = $iconSvgInline; + return $this; + } + + /** * @since 21.0.0 */ public function addMimetype(string $mimetype): TemplateFileCreator { @@ -104,7 +105,23 @@ final class TemplateFileCreator implements \JsonSerializable { } /** + * @since 27.0.0 + */ + public function setActionLabel(string $actionLabel): TemplateFileCreator { + $this->actionLabel = $actionLabel; + return $this; + } + + /** + * @since 27.0.0 + */ + public function getActionLabel(): string { + return $this->actionLabel; + } + + /** * @since 21.0.0 + * @return array{app: string, label: string, extension: string, iconClass: ?string, iconSvgInline: ?string, mimetypes: list<string>, ratio: ?float, actionLabel: string} */ public function jsonSerialize(): array { return [ @@ -112,8 +129,10 @@ final class TemplateFileCreator implements \JsonSerializable { 'label' => $this->actionName, 'extension' => $this->fileExtension, 'iconClass' => $this->iconClass, + 'iconSvgInline' => $this->iconSvgInline, 'mimetypes' => $this->mimetypes, - 'ratio' => $this->ratio + 'ratio' => $this->ratio, + 'actionLabel' => $this->actionLabel, ]; } } |