Comment on page
Phone
This field type renders a phone field.
- countries - an array of country codes to restrict the available prefixes;
- country - a country code for the default prefix selected.
The code below renders a required phone field with the
custom_field
name, "Custom field" label and "Custom text" placeholder. It allows the USA and Great Britain phone numbers only, with the USA code selected by default.echo ( new HivePress\Fields\Phone(
[
'name' => 'custom_field',
'label' => 'Custom field',
'placeholder' => 'Custom text',
'countries' => [ 'USA', 'GB' ],
'country' => 'USA',
'required' => true,
]
) )->render();
Last modified 1yr ago