Skip to main content
Version: 4


Jump To Section


Use this filter to change the order of array keys in the $form_data array.


This filter was introduced in Gravity PDF 4.4.


$order | array : The array of $form_data keys in the exact order they should get displayed


This snippet will re-order the misc and field keys in the $form_data array.

add_filter( 'gfpdf_form_data_key_order', function( $order ) {
/* Get the array key for the matching values */
$search_key = array_search( 'field', $order );
$search_key2 = array_search( 'misc', $order );

/* Remove the field array item from the $order */
$fields = array_splice( $order, $search_key, 1 );

/* Insert the field array before the misc array item in the $order */
array_splice( $order, $search_key2, 0, $fields );

return $order;
} );

Source Code

This filter is located in the Model_PDF::get_form_data() method of /src/model/Model_PDF.php.