public function UcAddressesAddress::varExport in Ubercart Addresses 6.2
Same name and namespace in other branches
- 7 class/UcAddressesAddress.class.php \UcAddressesAddress::varExport()
Export address instance to PHP code.
Return value
string PHP-code to reconstruct the address with.
File
- class/
UcAddressesAddress.class.php, line 547 - Contains the UcAddressesAddress class.
Class
- UcAddressesAddress
- The main address class used by uc_addresses (and extension modules).
Code
public function varExport() {
$data = $this
->getRawFieldData();
$code = '$fields = ' . var_export($data, TRUE) . ";\n";
$uid = $this
->getUserId();
if ($uid) {
$code .= '$address = UcAddressesAddressBook::get(' . $uid . ')->addAddress();' . "\n";
}
else {
$code .= '$address = UcAddressesAddressBook::newAddress();' . "\n";
}
$code .= '$address->setMultipleFields($fields);' . "\n";
return $code;
}