mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-19 08:20:30 +01:00
[Feature] Improves ForeignDocumentUUIDArrayField for can use documents to update it.
Fixes #389
This commit is contained in:
parent
b3c0344b91
commit
30fc66b87d
2 changed files with 10 additions and 1 deletions
|
|
@ -38,4 +38,13 @@ export default class ForeignDocumentUUIDField extends foundry.data.fields.Docume
|
|||
toObject(value) {
|
||||
return value?.uuid ?? value;
|
||||
}
|
||||
|
||||
/** @override */
|
||||
_cast(value) {
|
||||
if (typeof value === 'string') return value;
|
||||
if (value instanceof foundry.abstract.Document) return value.uuid;
|
||||
throw new Error(
|
||||
`The value provided to a ForeignDocumentUUIDField must be a ${foundry.abstract.Document.name} instance or a UUID string.`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue