The gform_consent_checked_indicator_markup filter in Gravity Forms allows you to modify the HTML markup of the Consent check box.
Usage
add_filter('gform_consent_checked_indicator_markup', 'your_function_name', 10, 1);
Parameters
$checked_indicator_markup
(string): The current HTML markup.
More information
See Gravity Forms Docs: gform_consent_checked_indicator_markup
Examples
Add a link to the consent check box
This example wraps the consent check box in a link to the Gravity Forms website.
add_filter('gform_consent_checked_indicator_markup', 'change_markup', 10, 1); function change_markup($checked_indicator_markup) { return '<a href="https://www.gravityforms.com">' . $checked_indicator_markup . '</a>'; }
Change the check box to a different HTML element
This example changes the consent check box to a button element.
add_filter('gform_consent_checked_indicator_markup', 'change_to_button', 10, 1); function change_to_button($checked_indicator_markup) { return '<button type="button">' . $checked_indicator_markup . '</button>'; }
Add a custom CSS class to the consent check box
This example adds a custom CSS class to the consent check box.
add_filter('gform_consent_checked_indicator_markup', 'add_custom_class', 10, 1); function add_custom_class($checked_indicator_markup) { return str_replace('<input', '<input class="custom-consent"', $checked_indicator_markup); }
Add a data attribute to the consent check box
This example adds a custom data attribute to the consent check box.
add_filter('gform_consent_checked_indicator_markup', 'add_data_attribute', 10, 1); function add_data_attribute($checked_indicator_markup) { return str_replace('<input', '<input data-custom-attribute="example"', $checked_indicator_markup); }
Add an icon to the consent check box label
This example adds an icon to the consent check box label.
add_filter('gform_consent_checked_indicator_markup', 'add_icon_to_label', 10, 1); function add_icon_to_label($checked_indicator_markup) { $icon_markup = '<i class="fas fa-check"></i>'; return str_replace('</label>', $icon_markup . '</label>', $checked_indicator_markup); }