From 962bcde7541efa633ca164f481399c777f68968e Mon Sep 17 00:00:00 2001 From: matty0501 <17788098+matty0501@users.noreply.github.com> Date: Fri, 28 Feb 2025 14:46:04 +0000 Subject: [PATCH] `gpapf-save-national-format.php`: Added new snippet. --- .../gpapf-save-national-format.php | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 gp-advanced-phone-field/gpapf-save-national-format.php diff --git a/gp-advanced-phone-field/gpapf-save-national-format.php b/gp-advanced-phone-field/gpapf-save-national-format.php new file mode 100644 index 000000000..33ff8966a --- /dev/null +++ b/gp-advanced-phone-field/gpapf-save-national-format.php @@ -0,0 +1,24 @@ +get_phone_number_proto( $value ); + $phone_number_util = \libphonenumber\PhoneNumberUtil::getInstance(); + if ( ! $proto ) { + return $value; + } + return $phone_number_util->format( $proto, \libphonenumber\PhoneNumberFormat::NATIONAL ); + +}, 10, 5 );