hPreObjectDisplay

This hook allows a plugin to modify an object before it is displayed. The most appropriate use is to remove information which the user should not be able to see, and only when they do not have permission to edit that object.

Adding or changing attributes is likely to confuse the user. Consider using an Element instead to display additional information by the side of the object.

The StoreObject passed to the hook is read only. mutableCopy() should be used to make a copy, which is then modified. To work well with other plugins, start with an existing replacement object if one already exists. For example:

P.hook('hPreObjectDisplay', function(response, object) {
    var r = response.replacementObject || object.mutableCopy();
    // modify r
    response.replacementObject = r;
});

Arguments

Name Type Description
object StoreObject The object being displayed

Response

Return information by changing these properties of the response object.

Name Type Description
replacementObject StoreObject An object to display in place of the given object, or null for no replacement
redirectPath String If set, the user will be redirected to this path instead of displaying the object

JavaScript template


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