Skip to content

Instantly share code, notes, and snippets.

@brettshumaker
Created January 9, 2018 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettshumaker/fd2e2ae8486dcc2b8381a85c90701bf0 to your computer and use it in GitHub Desktop.
Save brettshumaker/fd2e2ae8486dcc2b8381a85c90701bf0 to your computer and use it in GitHub Desktop.
Adding an "Address" format to FormidablePro2PDF
// Add this to the switch( $format ) statement in fpropdf_format_field() /format.php ~line 429
case 'address':
$v = maybe_unserialize( $v );
if ( ! is_array( $v ) )
break;
$address = '';
foreach ( $v as $key => $this_value ) {
switch ( $key ) {
case 'line1':
case 'line2':
$address .= $this_value . "\n";
break;
case 'city':
$address .= $this_value;
break;
case 'state':
$address .= isset( $v['city'] ) ? ', ' . $this_value : $this_value;
break;
case 'zip':
$address .= isset( $v['state'] ) || isset( $v['city'] ) ? ' '. $this_value . "\n" : $this_value . "\n";
break;
default:
$address .= $this_value;
break;
}
}
$v = $address;
break;
// Add this to the formats2 declaration /res/script.js line 243
// address: 'Address'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment