- Issue created by @joehuggans
The annotation/instructions in the PhoneInternationalElement class for using a field in a custom form are incorrect.
* @code
* $form['phone'] = [
* '#type' => 'phone_international',
* '#title' => $this->t('International Phone'),
* '#attributes' => [
* 'data-country' => 'PT',
* 'data-geo' => 0, // 0(Disable) or 1(Enable)
* 'data-exclude' => [],
* 'data-only' => [],
* 'data-preferred' => ['PT']
* ],
* ];
* @endcode
The settings for the field can not be added as attributes because they get overwritten in the processInternationalPhone method
Better document how to use the field with form api in a custom field, which is to use the array keys #countries, #exclude_countries, #country i.e.
* @code
* $form['phone'] = [
* '#type' => 'phone_international',
* '#title' => $this->t('International Phone'),
* '#countries' => 'all',
* '#country' => 'uk'
* ];
* @endcode
Active
3.3
Documentation