diff --git a/plugin.php b/plugin.php index 0995070..e298a47 100644 --- a/plugin.php +++ b/plugin.php @@ -4,7 +4,7 @@ * Plugin Name: Advanced Custom Fields: Phone Number * Plugin URI: https://github.com/log1x/acf-phone-number * Description: A real ACF phone number field. - * Version: 1.3.0 + * Version: 1.3.1 * Author: Brandon Nifong * Author URI: https://github.com/log1x */ diff --git a/src/PhoneNumberField.php b/src/PhoneNumberField.php index 252fdf5..f79855e 100644 --- a/src/PhoneNumberField.php +++ b/src/PhoneNumberField.php @@ -160,11 +160,13 @@ public function input_admin_enqueue_scripts() public function format_value($value, $post_id, $field) { $number = new PhoneNumber($value); + $format = $field['return_format'] ?? $this->defaults['return_format']; - return match ($field['return_format'] ?? $this->defaults['return_format']) { - 'array' => $number->toArray(), - default => $number, - }; + if ($format === 'array') { + return $number->toArray(); + } + + return $number; } /**