hLabelObject

Apply Labels to a newly created object, by adding or removing labels using a LabelChanges object passed to the hook function.

The Platform applies the configured Labels after this hook has been called. To remove default labels, use remove() on the LabelChanges to add them to the list of labels which shouldn’t be applied.

There’s also another hook, hLabelUpdatedObject, for re-labelling updated objects. This is a separate hook to encourage a practise of only labelling objects on creation.

See also hLabellingUserInterface for presenting UI in the editor for labelling objects.

Arguments

Name Type Description
object StoreObject The object which is about to be created

Response

Return information by changing these properties of the response object.

Name Type Description
changes LabelChanges Changes to apply to the label list

JavaScript template


P.hook('hLabelObject', function(response, object) {
    // Respond to hook, for example
    // response.changes = ...
});