public function PcaAddressFieldWidgetTrait::buildFieldWidgetFormElement in Loqate 2.x
Same name and namespace in other branches
- 8 src/PcaAddressFieldWidgetTrait.php \Drupal\loqate\PcaAddressFieldWidgetTrait::buildFieldWidgetFormElement()
2 calls to PcaAddressFieldWidgetTrait::buildFieldWidgetFormElement()
- AddressPcaAddressWidget::formElement in modules/
pca_address/ src/ Plugin/ Field/ FieldWidget/ AddressPcaAddressWidget.php - LoqatePcaAddressDefaultWidget::formElement in src/
Plugin/ Field/ FieldWidget/ LoqatePcaAddressDefaultWidget.php - Returns the form for a single field widget.
File
- src/
PcaAddressFieldWidgetTrait.php, line 73
Class
- PcaAddressFieldWidgetTrait
- Class PcaAddressFieldWidgetTrait.
Namespace
Drupal\loqateCode
public function buildFieldWidgetFormElement(array $element) {
$widget_settings = $this
->getSettings();
// Set field mapping settings.
$element['address']['#pca_fields'] = $widget_settings['pca_fields'];
// Set options settings.
$element['address']['#pca_options'] = $widget_settings['pca_options'];
// Set show address fields bool.
$element['address']['#show_address_fields'] = (bool) $widget_settings['show_address_fields'];
// Set allow manual input bool.
$element['address']['#allow_manual_input'] = (bool) $widget_settings['allow_manual_input'];
// Set options key if set.
if ($widget_settings['loqate_api_key']) {
$element['address']['#pca_options']['key'] = $widget_settings['loqate_api_key'];
}
return $element;
}