diff --git a/src/PhoneNumberField.php b/src/PhoneNumberField.php
index 01df135..131f9ed 100644
--- a/src/PhoneNumberField.php
+++ b/src/PhoneNumberField.php
@@ -32,6 +32,7 @@ class PhoneNumberField extends \acf_field
*/
public $defaults = [
'country' => 'us',
+ 'placeholder' => '+1 555-555-5555',
];
/**
@@ -80,9 +81,10 @@ public function render_field($field)
}
echo sprintf(
- '',
+ '',
$field['name'],
- $field['value']['number']
+ $field['value']['number'],
+ $field['placeholder'] ?? $this->defaults['placeholder']
);
echo sprintf(
@@ -111,6 +113,14 @@ public function render_field_settings($field)
'default_value' => $this->defaults['country'],
'choices' => (new PhoneNumber())->getCountries()
]);
+
+ acf_render_field_setting($field, [
+ 'label' => __('Placeholder', 'acf-phone-number'),
+ 'instructions' => __('The placeholder text for the phone number.', 'acf-phone-number'),
+ 'type' => 'text',
+ 'name' => 'placeholder',
+ 'default_value' => $this->defaults['placeholder'],
+ ]);
}
/**