hComputeAttributes is one of the building blocks of Computed attributes.

It should be used with caution. Care must be taken over permissions and behaviours which might confuse users.

Whenever an object is about to be saved, or the platform accesses attributes of mutable objects (for example, permissions checks and template objects for the object editor), this hook is called to allow plugins to modify the attributes.

Unlike most hooks, a mutable object is passed to this hook.

Object visibility will depend on the currently logged in user, so you may need to disable permission checking.


Name Type Description
object StoreObjectMutable The object to update with computed attributes


No data is returned in the response object.

JavaScript template

P.hook('hComputeAttributes', function(response, object) {
    // Respond to hook