Search
setAttributes
Use to rename any field:
setAttributes(attributes: UpdateFieldAttributes<typeof this>): Promise<typeof this | null
const updatedField = await field.setAttributes({ name: "New Name" })
And to set other attributes too, but make sure to narrow based on field's type first, as to avoid potential bugs:
if (field.type === "file") await field.setAttributes({ allowedFileTypes: ["txt", "md"] })
Returns the updated field on success, and null in the unlikely event of it being removed between getting it and calling this method.
Parameters
attributes:UpdateFieldAttributes<typeof this>– The attributes to update.
Returns
Promise<typeof this | null>