public static function TaxNumberDefaultWidget::replaceAjaxCallback in Commerce Core 8.2
Replaces the country_code #ajax callback in an Address widget.
Used as a #process callback because the country_code is a part of the Address form element, added on #process.
Parameters
array $element: The form element being processed.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
array $complete_form: The complete form structure.
Return value
array The form element.
File
- modules/
tax/ src/ Plugin/ Field/ FieldWidget/ TaxNumberDefaultWidget.php, line 213
Class
- TaxNumberDefaultWidget
- Plugin implementation of the 'commerce_tax_number_default' widget.
Namespace
Drupal\commerce_tax\Plugin\Field\FieldWidgetCode
public static function replaceAjaxCallback(array &$element, FormStateInterface $form_state, array &$complete_form) {
if (isset($element['country_code']['#ajax'])) {
$element['country_code']['#ajax'] = [
'callback' => [
get_called_class(),
'ajaxRefresh',
],
'wrapper' => $element['#form_wrapper'],
];
}
return $element;
}