Filter: bricks/form/action/{form_action}
The bricks/form/action/{form_action} filter is triggered when a custom action (one that is not reserved by Bricks) is selected in a form. It allows developers to define custom logic for handling such actions dynamically.
Bricks provides several reserved actions out of the box, including:
- redirect
- mailchimp
- sendgrid
- login
- registration
- lost-password
- reset-password
- custom
If the user’s selected action is not in this list, the bricks/form/action/{form_action} filter is triggered.
Example usage
Section titled “Example usage”Here’s how you can handle a custom action called slack-notification:
// Handle the Slack notification actionadd_action( 'bricks/form/action/slack-notification', function ( $form ) { $settings = $form->get_settings(); $fields = $form->get_fields();
// Implement Slack notification logic });Parameters:
Section titled “Parameters:”$form(\Bricks\Integrations\Form\Init): The current form instance, providing access to settings and submitted fields.
Was this page helpful?