Using Gravity Forms ‘gform_consent_checked_indicator’ PHP filter

The gform_consent_checked_indicator filter in Gravity Forms allows you to change the Consent check mark image.

Usage

add_filter('gform_consent_checked_indicator', 'your_function_name', 10, 1);

Parameters

  • $checked_indicator_url (string) – The URL of the image being used for the check mark.

More information

See Gravity Forms Docs: gform_consent_checked_indicator

Examples

This code replaces the default check mark image with a custom image.

add_filter('gform_consent_checked_indicator', 'change_image', 10, 1);
function change_image($checked_indicator_url) {
  // Replace the default image with a custom image
  return GFCommon::get_base_url() . '/images/star1.png';
}

Use an Image from Your Theme’s Directory

This code uses an image from your theme’s directory as the check mark.

add_filter('gform_consent_checked_indicator', 'use_theme_image', 10, 1);
function use_theme_image($checked_indicator_url) {
  // Use an image from your theme's directory
  return get_stylesheet_directory_uri() . '/images/custom-checkmark.png';
}

Use an External Image URL

This code sets the check mark image to an external image URL.

add_filter('gform_consent_checked_indicator', 'use_external_image', 10, 1);
function use_external_image($checked_indicator_url) {
  // Use an external image URL
  return 'https://example.com/images/external-checkmark.png';
}

Use a Different Image for Each Form

This code sets a different check mark image for each form based on the form ID.

add_filter('gform_consent_checked_indicator', 'use_form_specific_image', 10, 1);
function use_form_specific_image($checked_indicator_url) {
  // Get the current form object
  $form = GFFormsModel::get_current_form();

// Use a different image for each form based on the form ID return GFCommon::get_base_url() . ‘/images/checkmark-form’ . $form[‘id’] . ‘.png’; }

 

Use an SVG Image as the Check Mark

This code uses an SVG image as the check mark.

add_filter('gform_consent_checked_indicator', 'use_svg_image', 10, 1);
function use_svg_image($checked_indicator_url) {
  // Use an SVG image
  return GFCommon::get_base_url() . '/images/checkmark.svg';
}