You are here

public static function WebformEntityHandler::updateEntityFields in Webform Entity Handler 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/WebformHandler/WebformEntityHandler.php \Drupal\webform_entity_handler\Plugin\WebformHandler\WebformEntityHandler::updateEntityFields()

Ajax callback for the "Entity values" options form.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

\Drupal\Core\Ajax\AjaxResponse The ajax response.

File

src/Plugin/WebformHandler/WebformEntityHandler.php, line 277

Class

WebformEntityHandler
Create or update an entity with a webform submission values.

Namespace

Drupal\webform_entity_handler\Plugin\WebformHandler

Code

public static function updateEntityFields(array $form, FormStateInterface $form_state) {
  $triggering_element = $form_state
    ->getTriggeringElement();
  $array_parents = array_slice($triggering_element['#array_parents'], 0, -1);
  $element = NestedArray::getValue($form, $array_parents);
  $response = new AjaxResponse();
  $response
    ->addCommand(new ReplaceCommand('#webform-entity-handler--entity-values', $element['entity_values']));
  return $response;
}