scrivito.create_obj(attributes) --> Promise()
Use this function to create a new CMS object in the current working copy. The attributes of the new CMS object can be passed in as an object whose keys become the attribute names. The values of the keys become the attribute values.
The format of the attribute values is identical to the format used in the Ruby API with a couple of additional possibilities:
For binary attributes, you may pass in a JavaScript Blob
or File
object. The latter inherits from the former. The object is automatically uploaded to the CMS.
- For attributes of the
date
type, you may pass in a JavaScriptDate
object. It is automatically converted to the date format of the CMS.
The function returns a jQuery
Promise
. Once the Obj has been successfully created, the promise is fulfilled, and its success handler is called with an object, {id: "new-id"}
. new-id
is the ID of the Obj that has been created. An example: