Created
January 9, 2018 20:56
-
-
Save brettshumaker/fd2e2ae8486dcc2b8381a85c90701bf0 to your computer and use it in GitHub Desktop.
Adding an "Address" format to FormidablePro2PDF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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