Filter uncanny-automator

automator_keap_phone_type_label

Filters the label used for Keap phone type fields within the automator.

add_filter( 'automator_keap_phone_type_label', $callback, 10, 1 );

Description

Filters the label used for Keap phone type options within the Uncanny Automator integration. Developers can modify this label to customize how Keap phone types are displayed in the Automator interface, ensuring clear and user-friendly option naming.


Usage

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

Parameters

$type (mixed)
This parameter contains the raw phone type string fetched from Keap's contact configuration.

Return Value

The filtered value.


Examples

add_filter( 'automator_keap_phone_type_label', 'my_custom_keap_phone_type_label', 10, 1 );

/**
 * Customize the label for Keap phone types.
 *
 * This function takes a Keap phone type and returns a more user-friendly label.
 * For example, it might change 'work' to 'Business Phone'.
 *
 * @param string $type The original Keap phone type (e.g., 'work', 'home', 'mobile').
 * @return string The modified, user-friendly phone type label.
 */
function my_custom_keap_phone_type_label( $type ) {
    // Define a mapping of Keap phone types to custom labels.
    $custom_labels = array(
        'work'  => __( 'Business Phone', 'your-text-domain' ),
        'home'  => __( 'Home Phone', 'your-text-domain' ),
        'mobile' => __( 'Mobile Phone', 'your-text-domain' ),
        // Add more custom labels as needed.
    );

    // If a custom label exists for the given type, return it.
    // Otherwise, return the original type.
    if ( isset( $custom_labels[ $type ] ) ) {
        return $custom_labels[ $type ];
    }

    // Return the original type if no custom label is found.
    return $type;
}

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

src/integrations/keap/actions/keap-add-update-contact.php:450

private function get_phone_types_options() {
		$types   = $this->helpers->get_account_contact_config( 'phone_types', array() );
		$options = array();
		foreach ( $types as $type ) {
			$options[] = array(
				'text'  => apply_filters( 'automator_keap_phone_type_label', $type ),
				'value' => $type,
			);
		}
		return $options;
	}

Scroll to Top