cg_legalsigning_signature_field_fonts

Description

This filter allows you to filter both the fonts available to the Legal Signature field and the order they are provided to the field when using a Typed signature.

Note: This filter does not allow you to declare custom fonts, only filter the default fonts we make available to the field that come out of the box with Legal Signing. If an invalid font name is supplied using this filter, the Legal Signature field will default back to using the first default font in the list of default available fonts.

Usage

// Apply globally
add_filter( 'cg_legalsigning_signature_field_fonts', 'your_function_name', 10, 2 );
// Apply to a specific form
add_filter( 'cg_legalsigning_signature_field_fonts_123', 'your_function_name', 10, 2 );
// Apply to specific form and Legal Signature field ID
add_filter( 'cg_legalsigning_signature_field_fonts_123_5', 'your_function_name', 10, 2 );

Parameters

  • $field Field Object
    The Legal Signature field object
  • $fonts array
    The list of available fonts for the Legal Signature field, see below for the list of fonts and their names.

Available Fonts to Filter

Legal Signing ships with a handful of default fonts, at the time of writing this documentation they are as follows:

When filtering these fonts using this filter, fonts should be formatted in lowercase with a dash replacing any spaces in their names, e.g. “homemade-apple” or “caveat.”

If only one font is provided back to a Legal Signature field using this filter, the “Change Font” button usually in the field’s UI will be hidden automatically, as there are no other fonts to cycle through using that button.

Examples

Specify a list of only three fonts to use globally with Legal Signature fields on your site.

add_filter( 'cg_legalsigning_signature_field_fonts', function( $field, $fonts ) {
    return array( 'homemade-apple', 'dancing-script', 'rock-salt' );
}, 10, 2);

Specify a list of different fonts to use for two separate forms and their Legal Signature fields.

// Set fonts for form #12
add_filter( 'cg_legalsigning_signature_field_fonts_12', function( $field, $fonts ) {
    return array( 'homemade-apple', 'dancing-script', 'rock-salt' );
}, 10, 2);

// Set fonts for form #45
add_filter( 'cg_legalsigning_signature_field_fonts_45', function( $field, $fonts ) {
    return array( 'permanent-marker', 'caveat' );
}, 10, 2);