Using Gravity Forms ‘gform_trello_card’ PHP filter

The gform_trello_card Gravity Forms filter allows you to modify card properties before sending the data to Trello when using the Trello add-on.

Usage

To apply this filter to all forms:

add_filter('gform_trello_card', 'your_function_name', 10, 4);

To target a specific form (e.g., form ID 5):

add_filter('gform_trello_card_5', 'your_function_name', 10, 4);

Parameters

  • $card (array): The card properties.
  • $feed (Feed Object): The feed currently being processed.
  • $entry (Entry Object): The entry currently being processed.
  • $form (Form Object): The form currently being processed.

More information

See Gravity Forms Docs: gform_trello_card

Examples

Override the card name

Change the card name for a specific form (e.g., form ID 5):

add_filter('gform_trello_card_5', 'change_name', 10, 4);

function change_name($card, $feed, $entry, $form) {
    $card['name'] = 'Your new card name';
    return $card;
}

Decode encoded characters in card description

Decode special characters in the card description for all forms:

add_filter('gform_trello_card', function($card) {
    $card['desc'] = htmlspecialchars_decode($card['desc'], ENT_QUOTES);
    return $card;
});

Add custom labels

Add custom labels to the card for a specific form (e.g., form ID 5):

add_filter('gform_trello_card_5', 'add_custom_labels', 10, 4);

function add_custom_labels($card, $feed, $entry, $form) {
    $card['labels'] = 'red,blue';
    return $card;
}

Add member ID to the card

Assign a member to the card for a specific form (e.g., form ID 5):

add_filter('gform_trello_card_5', 'add_member_id', 10, 4);

function add_member_id($card, $feed, $entry, $form) {
    $card['idMembers'] = 'TRELLO_MEMBER_ID_HERE';
    return $card;
}

Set a due date for the card

Set a due date for the card for a specific form (e.g., form ID 5):

add_filter('gform_trello_card_5', 'set_due_date', 10, 4);

function set_due_date($card, $feed, $entry, $form) {
    $card['due'] = '2023-06-01T00:00:00+00:00';
    return $card;
}