summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files/lib/ResponseDefinitions.php1
-rw-r--r--apps/files/src/newMenu/newFromTemplate.ts2
-rw-r--r--apps/files/src/types.ts1
-rw-r--r--lib/public/Files/Template/TemplateFileCreator.php14
4 files changed, 16 insertions, 2 deletions
diff --git a/apps/files/lib/ResponseDefinitions.php b/apps/files/lib/ResponseDefinitions.php
index 5e565cc356d..a3b62549bcc 100644
--- a/apps/files/lib/ResponseDefinitions.php
+++ b/apps/files/lib/ResponseDefinitions.php
@@ -44,6 +44,7 @@ namespace OCA\Files;
* label: string,
* extension: string,
* iconClass: ?string,
+ * iconSvgInline: ?string,
* mimetypes: string[],
* ratio: ?float,
* actionLabel: string,
diff --git a/apps/files/src/newMenu/newFromTemplate.ts b/apps/files/src/newMenu/newFromTemplate.ts
index 5e69181995e..42e24c59de0 100644
--- a/apps/files/src/newMenu/newFromTemplate.ts
+++ b/apps/files/src/newMenu/newFromTemplate.ts
@@ -64,8 +64,8 @@ export function registerTemplateEntries() {
addNewFileMenuEntry({
id: `template-new-${provider.app}-${index}`,
displayName: provider.label,
- // TODO: migrate to inline svg
iconClass: provider.iconClass || 'icon-file',
+ iconSvgInline: provider.iconSvgInline,
enabled(context: Folder): boolean {
return (context.permissions & Permission.CREATE) !== 0
},
diff --git a/apps/files/src/types.ts b/apps/files/src/types.ts
index 0e9dd6fb531..aa9164c873f 100644
--- a/apps/files/src/types.ts
+++ b/apps/files/src/types.ts
@@ -117,6 +117,7 @@ export interface TemplateFile {
label: string
extension: string
iconClass?: string
+ iconSvgInline?: string
mimetypes: string[]
ratio?: number
templates?: Record<string, unknown>[]
diff --git a/lib/public/Files/Template/TemplateFileCreator.php b/lib/public/Files/Template/TemplateFileCreator.php
index 0c2f7a115a2..40a68461bc1 100644
--- a/lib/public/Files/Template/TemplateFileCreator.php
+++ b/lib/public/Files/Template/TemplateFileCreator.php
@@ -37,6 +37,8 @@ final class TemplateFileCreator implements \JsonSerializable {
protected $fileExtension;
/** @var ?string $iconClass */
protected $iconClass;
+ /** @var ?string $iconSvgInline */
+ protected $iconSvgInline;
/** @var ?float $ratio */
protected $ratio = null;
protected $order = 100;
@@ -66,6 +68,7 @@ final class TemplateFileCreator implements \JsonSerializable {
/**
* @since 21.0.0
+ * @deprecated 29.0.0
*/
public function setIconClass(string $iconClass): TemplateFileCreator {
$this->iconClass = $iconClass;
@@ -73,6 +76,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 {
@@ -128,7 +139,7 @@ final class TemplateFileCreator implements \JsonSerializable {
/**
* @since 21.0.0
- * @return array{app: string, label: string, extension: string, iconClass: ?string, mimetypes: string[], ratio: ?float, actionLabel: string}
+ * @return array{app: string, label: string, extension: string, iconClass: ?string, iconSvgInline: ?string, mimetypes: string[], ratio: ?float, actionLabel: string}
*/
public function jsonSerialize(): array {
return [
@@ -136,6 +147,7 @@ final class TemplateFileCreator implements \JsonSerializable {
'label' => $this->actionName,
'extension' => $this->fileExtension,
'iconClass' => $this->iconClass,
+ 'iconSvgInline' => $this->iconSvgInline,
'mimetypes' => $this->mimetypes,
'ratio' => $this->ratio,
'actionLabel' => $this->actionLabel,