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
- $card array
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', );
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.
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 should be placed in the functions.php file of your active theme.
Source Code
$card = gf_apply_filters( 'gform_trello_card', array( $form['id'] ), $card, $feed, $entry, $form );
This filter is located in GFTrello::process_feed() in class-gf-trello.php.