Description
This filter can be used to change the card properties before sending the data to Trello when using the Trello add-on.
Usage
The following would apply to all forms:
add_filter( 'gform_trello_card', 'your_function_name', 10, 4 );
To target a specific form append the form id to the hook name. (format: gform_trello_card_FORMID)
add_filter( 'gform_trello_card_5', 'your_function_name', 10, 4 );
Parameters
| Parameter | Type | Description |
|---|---|---|
$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. |
array(
'name' => 'New submission from feed add-on',
'desc' => 'Please add the ability to ....',
'labels' => 'green',
'idMembers' => 'TRELLO_MEMBER_ID_HERE',
'due' => '2016-10-01T00:00:00+00:00',
);
Examples
1. Override the card name
This example shows how you can override the card name.
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
}
2. Decode encoded characters in card description
add_filter( 'gform_trello_card', function( $card ) {
$card['desc'] = htmlspecialchars_decode( $card['desc'], ENT_QUOTES );
return $card;
} );
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Source Code
This filter is located in GFTrello::process_feed() in class-gf-trello.php.