Action: bricks/form/custom_action
Runs when a form with a “Custom” action is submitted. This allows you to execute custom PHP logic to handle the form submission.
Parameters
Section titled “Parameters”$form(Bricks\Form): The form instance.
Example usage
Section titled “Example usage”add_action( 'bricks/form/custom_action', function( $form ) { // Get form fields $fields = $form->get_fields();
// Get form settings $settings = $form->get_settings();
// Get submitted data $form_data = $fields['formId'] ?? []; // Or retrieve specific field values
// Perform custom logic, e.g., send to external API $name = isset( $fields['form-field-name'] ) ? $fields['form-field-name'] : '';
if ( $name === 'Specific Name' ) { // Do something $form->set_result( [ 'type' => 'success', // or 'danger', 'info', 'warning' 'message' => esc_html__( 'Custom action executed successfully.', 'bricks' ), ] ); }} );Was this helpful?
A quick vote and short notes help us improve these docs faster.
Leave a note for us
Please do not include passwords, license keys, or personal data. We store submitted notes to improve the docs.
Thanks for sharing feedback. We're using it to improve these docs.