afterCount( )
A hook that is triggered after a count()
operation.
The afterCount()
hook runs when:
- The
count()
function is called. - The collection is viewed in the CMS.
Return a number or a Promise that resolves to number from the afterCount()
function. The returned number will be used as the result of the call to
count()
instead of the actual count of
items found in the collection. If returning a Promise, the number is used as
the result, whether the Promise is fulfilled or rejected.
If the returned value is of the wrong type, the value is ignored.
A rejected Promise also calls the onFailure()
hook if it has
been registered.
Method Declaration
Copy
Method Parameters
countnumberRequired
The number of items the count operation has found.
contextHookContextRequired
Contextual information about the hook.
Returns
Return Type:Promise<number> | number
Was this helpful?
Yes
No