Skip to content

Controller

filters()

filters() — returns void

Available in: controller Category: Configuration Functions

Tells CFWheels to run a function before an action is run or after an action has been run.

NameTypeRequiredDefaultDescription
throughstringyesFunction(s) to execute before or after the action(s).
typestringnobeforeWhether to run the function(s) before or after the action(s).
onlystringnoPass in a list of action names (or one action name) to tell CFWheels that the filter function(s) should only be run on these actions.
exceptstringnoPass in a list of action names (or one action name) to tell CFWheels that the filter function(s) should be run on all actions except the specified ones.
placementstringnoappendPass in prepend to prepend the function(s) to the filter chain instead of appending.
// Always execute `restrictAccess` before all actions in this controller.
filters("restrictAccess");

// Always execute `isLoggedIn` and `checkIPAddress` (in that order) before all actions in this controller, except the `home` and `login` actions.
filters(through="isLoggedIn, checkIPAddress", except="home, login");