You are here

public function WebformSubmissionValue::pluginTypeChangeSubmit in Pardot Integration 2.x

Set the mapping array on change.

Parameters

array $form: The form array.

\Drupal\Core\Form\FormStateInterface $form_state: The form state object.

File

src/Plugin/PardotFormMapFormatterPlugin/WebformSubmissionValue.php, line 285

Class

WebformSubmissionValue
Plugin to generate a text field and consume tokens for mappings.

Namespace

Drupal\pardot\Plugin\PardotFormMapFormatterPlugin

Code

public function pluginTypeChangeSubmit(array &$form, FormStateInterface $form_state) {
  $trigger_element = $form_state
    ->getTriggeringElement();
  $parents = array_slice($trigger_element['#array_parents'], 0, -1);
  $parents[] = 'element';
  $wrapper_hash = $trigger_element['#wrapper_hash'];
  $plugin_type = NestedArray::getValue($form, $parents)['#value'];
  $form_state
    ->set("element_type__{$wrapper_hash}", $plugin_type);
  $form_state
    ->setRebuild();
}