- Handle Custom Stripe Webhook Events
- suredonation_export_secret_option_keys Filter Hook
- suredonation_import_batch_complete Action Hook
- suredonation_import_complete Action Hook
- suredonation_import_donation_inserted Action Hook
- suredonation_import_donor_inserted Action Hook
- suredonation_import_session_created Action Hook
- suredonation_import_givewp_batch_complete Action Hook
- suredonation_import_givewp_session_created Action Hook
- suredonation_privacy_data_exported Action Hook
- Validate Field Filter Hook
- Validatable Blocks Filter Hook
- Update donation data, Filter Hook
- OttoKit Integration: suredonation_suretriggers_integration_data_filter Filter Hook
- suredonation_show_setup_gateway_notice Filter Hook
- suredonation_show_review_notice_gateway Filter Hook
- suredonation_show_review_notice_donation Filter Hook
- suredonation_registered_payment_methods Filter Hook
- suredonation_register_additional_blocks Filter Hook
- suredonation_receipt_html Filter Hook
- suredonation_phone_geo_enabled Filter Hook
- suredonation_phone_geo_api_hourly_cap Filter Hook
- suredonation_paypal_webhook_handle_event Filter Hook
- suredonation_paypal_sdk_args Filter Hook
- suredonation_output_campaign_meta_tags Filter Hook
- suredonation_new_donor_user_data Filter Hook
- suredonation_integration_payload Filter Hook
- suredonation_import_phase_mappers Filter Hook
- suredonation_import_givewp_phases Filter Hook
- suredonation_import_givewp_phase_mappers Filter Hook
- suredonation_import_donation_row Filter Hook
- suredonation_import_campaigns_limit Filter Hook
- suredonation_field_block_config Filter Hook
- suredonation_export_one_time_only Filter Hook
- suredonation_export_campaigns_limit Filter Hook
- suredonation_email_smart_tags Filter Hook
- suredonation_email_smart_tag_groups Filter Hook
- suredonation_email_field_char_limits Filter Hook
- suredonation_disable_default_styles Filter Hook
- suredonation_default_validation_messages Filter Hook
- suredonation_default_email_notifications Filter Hook
- suredonation_create_donation_data Filter Hook
- suredonation_config_abilities Filter Hook
- suredonation_available_payment_methods Filter Hook
- suredonation_allowed_form_html Filter Hook
- suredonation_allowed_form_blocks Filter Hook
- Validatable Blocks Filter Hook
- Update donation data, Filter Hook
- OttoKit Integration: suredonation_suretriggers_integration_data_filter Filter Hook
- suredonation_show_setup_gateway_notice Filter Hook
- suredonation_show_review_notice_gateway Filter Hook
- suredonation_show_review_notice_donation Filter Hook
- suredonation_registered_payment_methods Filter Hook
- suredonation_register_additional_blocks Filter Hook
- suredonation_receipt_html Filter Hook
- suredonation_phone_geo_enabled Filter Hook
- suredonation_phone_geo_api_hourly_cap Filter Hook
- suredonation_paypal_webhook_handle_event Filter Hook
- suredonation_paypal_sdk_args Filter Hook
- suredonation_output_campaign_meta_tags Filter Hook
- suredonation_new_donor_user_data Filter Hook
- suredonation_integration_payload Filter Hook
- suredonation_import_phase_mappers Filter Hook
- suredonation_import_givewp_phases Filter Hook
- suredonation_import_givewp_phase_mappers Filter Hook
- suredonation_import_donation_row Filter Hook
- suredonation_import_campaigns_limit Filter Hook
- suredonation_field_block_config Filter Hook
- suredonation_export_secret_option_keys Filter Hook
- suredonation_export_one_time_only Filter Hook
- suredonation_export_campaigns_limit Filter Hook
- suredonation_email_smart_tags Filter Hook
- suredonation_email_smart_tag_groups Filter Hook
- suredonation_email_field_char_limits Filter Hook
- suredonation_disable_default_styles Filter Hook
- suredonation_default_validation_messages Filter Hook
- suredonation_default_email_notifications Filter Hook
- suredonation_create_donation_data Filter Hook
- suredonation_config_abilities Filter Hook
- suredonation_available_payment_methods Filter Hook
- suredonation_allowed_form_html Filter Hook
- suredonation_allowed_form_blocks Filter Hook
- suredonation_import_batch_complete Action Hook
- suredonation_import_complete Action Hook
- suredonation_import_donation_inserted Action Hook
- suredonation_import_donor_inserted Action Hook
- suredonation_import_session_created Action Hook
- suredonation_import_givewp_batch_complete Action Hook
- suredonation_import_givewp_session_created Action Hook
- suredonation_privacy_data_exported Action Hook
- suredonation_enqueue_form_frontend_scripts Action Hook
- suredonation_after_form_duplicated Action Hook
- suredonation_email_sent Action Hook
- suredonation_donor_user_created Action Hook
- suredonation_donation_refunded Action Hook
- suredonation_donation_status_changed Action Hook
- suredonation_donation_completed Action Hook
- suredonation_new_donation Action Hook
- suredonation_donation_created Action Hook
suredonation_field_block_config Filter Hook
Overview
The suredonation_field_block_config filter allows developers to customize the validation configuration stored for individual form blocks when a SureDonation form is saved.
Use this filter when you create a custom field block that requires validation rules that are not handled by SureDonation core.
The configuration saved through this filter can later be used by suredonation_validate_field to validate submitted values.
When to Use This Filter
Use this filter when you need to:
- Add validation settings for a custom field block.
- Store custom validation rules when a form is saved.
- Define whether a custom field is required.
- Store field-specific limits such as maximum length.
- Provide configuration that will be used during server-side validation.
Filter Signature
apply_filters( 'suredonation_field_block_config', $processed_config, $block_name, Â $block['attrs'], $blocks );Parameters
| Parameter | Type | Description |
| $processed_config | array|null | Configuration generated by SureDonation core. null when the block type is not handled by core. |
| $block_name | string | The block name, such as suredonation/input. |
| $attrs | array | Attributes configured for the current block. |
| $blocks | array | All blocks in the form being processed. |
$processed_config
When SureDonation core recognizes the block, this parameter may already contain validation rules.
For an unsupported custom block, it can be: null
Your callback can return a custom configuration array for the block.
Return Value
Return an array containing the validation configuration you want to store.
return [
    'required' => true,
];The configuration should contain at least a required value and any additional values required by your validator.
You can also return the original value:
return $processed_config;
If the returned configuration is null or empty, no configuration is stored for that block.
Basic Usage
add_filter( 'suredonation_field_block_config', 'your_custom_function', 10, 4);
function your_custom_function(
    $processed_config,
    $block_name,
    $attrs,
    $blocks
) {
    // Return a config array for your custom block
    // or return the original value.
    return $processed_config;
}Example: Add Configuration for a Custom Field
The following example adds validation settings for a custom field named mysite/custom-field.
add_filter( 'suredonation_field_block_config', 'mysite_field_config', 10, 4);
function mysite_field_config(
    $processed_config,
    $block_name,
    $attrs,
    $blocks
) {
    if ( 'mysite/custom-field' === $block_name ) {
        return [
            'required'  => ! empty( $attrs['required'] ),
            'max_length' => (int) ( $attrs['maxLength'] ?? 0 ),
        ];
    }
    return $processed_config;
}In this example:
- required determines whether the field is mandatory.
- max_length stores the maximum allowed length.
- The configuration is saved with the form.
Validation Flow
This filter is part of the form validation configuration process:
- A SureDonation form is saved.
- SureDonation processes each block in the form.
- Core generates validation configuration for supported blocks.
- The suredonation_field_block_config filter runs.
- Your callback can add or modify the configuration.
- The configuration is stored against the block ID.
- When the form is submitted, the stored configuration is loaded.
- suredonation_validate_field uses the configuration to validate the submitted value.
Working With Custom Fields
If your plugin adds a custom field block, you can use this filter to store the validation rules for that block.
For example:
Custom Field Block
↓
suredonation_field_block_config
↓
Validation Configuration Saved
↓
Form Submission
↓
suredonation_validate_field
↓
Custom Validation
For the validation configuration to be used during submission, your custom block should also be registered with:
suredonation_validatable_blocks
Example: Store Multiple Validation Rules
You can store multiple values required by your custom validator.
add_filter(  'suredonation_field_block_config', 'mysite_custom_validation_config',  10,  4
);
function mysite_custom_validation_config(
    $processed_config,
    $block_name,
    $attrs,
    $blocks
) {
    if ( 'mysite/custom-field' !== $block_name ) {
        return $processed_config;
    }
    return [
        'required'  => ! empty( $attrs['required'] ),
        'max_length' => (int) ( $attrs['maxLength'] ?? 100 ),
        'prefix'   => sanitize_text_field( $attrs['prefix'] ?? '' ),
    ];
}The stored configuration can then be read by your validation callback.
Important: Configuration vs Validation
This filter does not validate the submitted field value.
It only defines the configuration that is saved when the form is saved.
Use:
suredonation_validate_field
to apply validation rules to submitted values.
For example:
suredonation_field_block_config
↓
Stores validation rules
↓
suredonation_validate_field
↓
Validates submitted value
Related Hooks
- Suredonation_validatable_blocks: Registers block types whose submitted values should be validated.
- Suredonation_validate_field: Validates individual field values using the stored configuration.
We don't respond to the article feedback, we use it to improve our support content.