diff options
author | Elizabeth Danzberger <lizzy7128@tutanota.de> | 2025-04-28 13:22:19 -0400 |
---|---|---|
committer | Elizabeth Danzberger <lizzy7128@tutanota.de> | 2025-04-28 15:19:31 -0400 |
commit | 9112dce0512304e1317a7298d22b9b172c1ce340 (patch) | |
tree | 774a9545aead40aff6353f5b9bf3ea1a0548121d /lib | |
parent | 40e52e212ac32758b6d8b7a06e8e6f747fefe823 (diff) | |
download | nextcloud-server-feat/template-field-extraction-improvements.tar.gz nextcloud-server-feat/template-field-extraction-improvements.zip |
feat: only get template fields once selectedfeat/template-field-extraction-improvements
In order to improve the performance and flow of creating a new file
from a template, the `setFields` method will be deprecated and we
instead use a new property, `setFieldsUrl`, which allows apps to
specify an endpoint for extracting the template fields. This endpoint
is used by the template picker to request the fields only once the
user has selected a template, instead of fetching all template fields
before opening and causing a terribly slow experience.
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/public/Files/Template/Template.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/public/Files/Template/Template.php b/lib/public/Files/Template/Template.php index 7f01c2afa48..b3ecbb91073 100644 --- a/lib/public/Files/Template/Template.php +++ b/lib/public/Files/Template/Template.php @@ -26,6 +26,8 @@ final class Template implements \JsonSerializable { private $previewUrl = null; /** @var list<Field> */ private $fields = []; + /** @var string|null */ + private $fieldsUrl = null; /** * @since 21.0.0 @@ -51,6 +53,7 @@ final class Template implements \JsonSerializable { } /** + * @deprecated * @param list<Field> $fields * @since 30.0.0 */ @@ -59,6 +62,14 @@ final class Template implements \JsonSerializable { } /** + * @param string $fieldsUrl + * @since 32.0.0 + */ + public function setFieldsUrl(string $fieldsUrl): void { + $this->fieldsUrl = $fieldsUrl; + } + + /** * @return array{ * templateType: string, * templateId: string, @@ -72,6 +83,7 @@ final class Template implements \JsonSerializable { * type: string, * hasPreview: bool, * previewUrl: ?string, + * fieldsUrl: ?string, * fields: list<array{ * index: string, * type: string, @@ -99,6 +111,7 @@ final class Template implements \JsonSerializable { 'hasPreview' => $this->hasPreview, 'previewUrl' => $this->previewUrl, 'fields' => array_map(static fn (Field $field) => $field->jsonSerialize(), $this->fields), + 'fieldsUrl' => $this->fieldsUrl, ]; } } |