You are here

public static function ComponentSectionForm::addComplexDataSubmit in Module Builder 8.3

File

src/Form/ComponentSectionForm.php, line 681

Class

ComponentSectionForm
Generic form for entering a section of data for a component.

Namespace

Drupal\module_builder\Form

Code

public static function addComplexDataSubmit(array $form, FormStateInterface $form_state) {
  $button = $form_state
    ->getTriggeringElement();
  $data = $form_state
    ->get('data');
  $complex_data_item = $data
    ->getItem($button['#data_address']);

  // Access the data to cause it to instantiate.
  $complex_data_item
    ->access();
  $form_state
    ->set('data', $data);
  $form_state
    ->setRebuild();
}