You are here

public static function TaxNumberDefaultWidget::ajaxRefresh in Commerce Core 8.2

Ajax callback.

File

modules/tax/src/Plugin/Field/FieldWidget/TaxNumberDefaultWidget.php, line 226

Class

TaxNumberDefaultWidget
Plugin implementation of the 'commerce_tax_number_default' widget.

Namespace

Drupal\commerce_tax\Plugin\Field\FieldWidget

Code

public static function ajaxRefresh(array $form, FormStateInterface $form_state) {

  // Find the entity form based on the expected address widget structure
  // (e.g. $form['address']['widget'][0]['address']['country_code']).
  $triggering_element = $form_state
    ->getTriggeringElement();
  $parents = array_slice($triggering_element['#array_parents'], 0, -6);
  return NestedArray::getValue($form, $parents);
}