modules/acm/src/Element/AcmAddress.php
public static function addressAjaxCallback(array $form, FormStateInterface $form_state, Request $request) {
    $form_parents = explode('/', $request->query->get('element_parents'));

    // Retrieve the element to be rendered.
    $form = NestedArray::getValue($form, $form_parents);

    $values = $form_state->getValue($form['#parents']);
    $country = $values['country_id'];

    $dynamic_parts = self::calculateDynamicParts($country);
    return array_replace_recursive($form['dynamic_parts'], $dynamic_parts);
  }
public static function addressAjaxCallback(array $form, FormStateInterface $form_state, Request $request) {
    $form_parents = explode('/', $request->query->get('element_parents'));

    // Retrieve the element to be rendered.
    $form = NestedArray::getValue($form, $form_parents);

    $values = $form_state->getValue($form['#parents']);
    $country = $values['country_id'];

    $dynamic_parts = self::calculateDynamicParts($country);
    return array_replace_recursive($form['dynamic_parts'], $dynamic_parts);
  }
public static function addressAjaxCallback ( array $ form , FormStateInterface $ form_state , Request $ request ) { $ form_parents = explode ( '/' , $ request -> query -> get ( 'element_parents' ) ) ; // Retrieve the element to be rendered. $ form = NestedArray :: getValue ( $ form , $ form_parents ) ; $ values = $ form_state -> getValue ( $ form [ '#parents' ] ) ; $ country = $ values [ 'country_id' ] ; $ dynamic_parts = self :: calculateDynamicParts ( $ country ) ; return array_replace_recursive ( $ form [ 'dynamic_parts' ] , $ dynamic_parts ) ; }
Ajax handler for country selector.

@param array $form
The build form.
@param \Drupal\Core\Form\FormStateInterface $form_state
The form state.
@param \Symfony\Component\HttpFoundation\Request $request
The current request.

@return \Drupal\Core\Ajax\AjaxResponse
The ajax response of the ajax upload.
Ajax handler for country selector .