public function CountryStateCityWidget::ajaxFillState in Country, State and City Fields 8
Call the function that consume the webservice.
Parameters
array $form: A form that be modified.
\Drupal\Core\Form\FormStateInterface $form_state: The values of the form.
Return value
array The form modified
File
- src/
Plugin/ Field/ FieldWidget/ CountryStateCityWidget.php, line 298
Class
- CountryStateCityWidget
- Plugin implementation of the 'country_state_city_widget' widget.
Namespace
Drupal\country_state_city\Plugin\Field\FieldWidgetCode
public function ajaxFillState(array $form, FormStateInterface $form_state) {
$element = $form_state
->getTriggeringElement();
$delta = $element['#delta'];
$field_name = $this->fieldDefinition
->getName();
$form = $form[$field_name];
unset($form['widget'][$delta]['_weight']);
return $form['widget'][$delta];
}