You are here

public static function ElementSubmit::doSubmit in Inline Entity Form 8

Submits elements by calling their #ief_element_submit callbacks.

Parameters

array $element: The element.

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

1 call to ElementSubmit::doSubmit()
ElementSubmit::trigger in src/ElementSubmit.php
Button #submit callback: Triggers submission of element forms.

File

src/ElementSubmit.php, line 98

Class

ElementSubmit
Provides #ief_element_submit, the submit version of #element_validate.

Namespace

Drupal\inline_entity_form

Code

public static function doSubmit(&$element, FormStateInterface $form_state) {

  // Recurse through all children.
  foreach (Element::children($element) as $key) {
    if (!empty($element[$key])) {
      static::doSubmit($element[$key], $form_state);
    }
  }

  // If there are callbacks on this level, run them.
  if (!empty($element['#ief_element_submit'])) {
    foreach ($element['#ief_element_submit'] as $callback) {
      call_user_func_array($callback, [
        &$element,
        &$form_state,
      ]);
    }
  }
}