public static function ElementSubmit::trigger in Inline Entity Form 8
Button #submit callback: Triggers submission of element forms.
Parameters
array $form: The form.
\Drupal\Core\Form\FormStateInterface $form_state: The form state.
File
- src/
ElementSubmit.php, line 75
Class
- ElementSubmit
- Provides #ief_element_submit, the submit version of #element_validate.
Namespace
Drupal\inline_entity_formCode
public static function trigger(&$form, FormStateInterface $form_state) {
$triggered_element = $form_state
->getTriggeringElement();
if (!empty($triggered_element['#ief_submit_trigger_all'])) {
// The parent form was submitted, process all IEFs and their children.
static::doSubmit($form, $form_state);
}
else {
// A specific element was submitted, process it and all of its children.
$array_parents = $triggered_element['#array_parents'];
$array_parents = array_slice($array_parents, 0, -2);
$element = NestedArray::getValue($form, $array_parents);
static::doSubmit($element, $form_state);
}
}