var updateHandler = new updateHandler(list:KeystoneList, item:MongooseObject, req:RequestObject, options:Object)
Update Handler is a constructor from a collection of complex objects, to allow you to update an item, and return flash errors to the user. It is mostly used internally by Keystone, however if you wish to use flash errors, it is accessible. behind the scenes its process method uses the updateItem property on the passed in list. Its arguments are:
|list||A Keystone list, retrieved with keystone.list . This is the list of the item you want to update.|
|item||A mongoose object retrieved from the database.|
|req||A request object provided to us by express. If there is a user on the request object, this will be added to the options when the data is processed. If there are files on the request object, they will be added to the options object.|
|options||The options object has two purposes. It will be passed in to the
Determines whether the req object should have flash errors added to it for when the return occurs and there are errors. Accepts a boolean, defaulting to false. it also accepts the strings
update, which limit what errors are returned as flash errors.
The type of each flash error is
error, and it returns an object with
list, which includes the body of the errors.
The errorMessage to include with the flashErrors. This will be defaulted to
'There was a problem saving your changes' if none was provided.
If this is true, a console error will be printed when there is an error in processing the data.
updateHandler.process(data:Object[, options:Object], callback:Function)
A method on an updateHandler. When called, it processes the update, using the data passed in. It can also take in an options object, which is mapped to the options passed into the udpateHandler's creation.
updateItem function is used to process the update.