Skip to content

Instantly share code, notes, and snippets.

@cliffordp

cliffordp/functions.php

Last active Jun 22, 2021
Embed
What would you like to do?
Gravity Forms Zoho CRM Add-On -- Decode HTML when sending to Zoho CRM so links work, such as link to the entry
<?php
/**
* Gravity Forms Zoho CRM Add-On -- Decode HTML when sending to Zoho CRM so links work, such as link to the entry.
*
* @link https://gist.github.com/cliffordp/0d45eae807c190fed0a95de66a655224 This snippet.
* @link https://docs.gravityforms.com/gform_merge_tag_filter/#9-decode-modifier Alter this snippet if you prefer to require e.g. {entry_url:decode}
*/
add_filter( 'gform_zohocrm_task', 'cliff_zoho_crm_task_decode_description', 10, 4 );
if( ! function_exists( 'cliff_zoho_crm_task_decode_description' ) ) {
/**
* Decode HTML special characters from Zoho CRM Task Description.
*/
function cliff_zoho_crm_task_decode_description( $task, $feed, $entry, $form ) {
GFCommon::log_debug( __METHOD__ . '():Original Description: ' . $task['Description'] );
$task['Description'] = htmlspecialchars_decode( $task['Description'] );
GFCommon::log_debug( __METHOD__ . '():Decoded Description: ' . $task['Description'] );
return $task;
}
}
add_filter( 'gform_zohocrm_lead', 'cliff_zoho_crm_lead_decode_description', 10, 4 );
if( ! function_exists( 'cliff_zoho_crm_lead_decode_description' ) ) {
/**
* Decode HTML special characters from Zoho CRM Lead Description.
*/
function cliff_zoho_crm_lead_decode_description( $lead, $feed, $entry, $form ) {
GFCommon::log_debug( __METHOD__ . '():Original Description: ' . $lead['Description'] );
$lead['Description'] = htmlspecialchars_decode( $lead['Description'] );
GFCommon::log_debug( __METHOD__ . '():Decoded Description: ' . $lead['Description'] );
return $lead;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment