diff --git a/lib/Service/TemplateFieldService.php b/lib/Service/TemplateFieldService.php index a74e9d5f55..f0d6a03e38 100644 --- a/lib/Service/TemplateFieldService.php +++ b/lib/Service/TemplateFieldService.php @@ -14,6 +14,7 @@ use OCP\Files\Node; use OCP\Files\NotFoundException; use OCP\Files\Template\Field; +use OCP\Files\Template\FieldFactory; use OCP\Files\Template\FieldType; use OCP\Http\Client\IClientService; use OCP\ICacheFactory; @@ -94,17 +95,17 @@ public function extractFields(Node|int $file): array { continue; } - $field = new Field($index, $fieldType); - $field->id = $attr["id"]; - $field->tag = $attr["tag"]; - $field->alias = $attr["alias"]; + $field = FieldFactory::createField($index, $fieldType); + $field->id = $attr['id']; + $field->tag = $attr['tag']; + $field->alias = $attr['alias']; switch ($fieldType) { case FieldType::RichText: - $field->content = $attr["content"]; + $field->setValue($attr['content']); break; case FieldType::CheckBox: - $field->checked = ($attr["Checked"] === "true"); + $field->setValue($attr['Checked'] === 'true'); break; default: break;