// been identified yet, default it to the first button.
$buttons =
$form_state->
getButtons();
if (!
$form_state->
isProgrammed() && !
$form_state->
getTriggeringElement() && !
empty($buttons)) { $form_state->
setTriggeringElement($buttons[0
]);
} $triggering_element =
$form_state->
getTriggeringElement();
// If the triggering element specifies "button-level" validation and
// submit handlers to run instead of the default form-level ones, then add
// those to the form state.
if (isset($triggering_element['#validate'
])) { $form_state->
setValidateHandlers($triggering_element['#validate'
]);
} if (isset($triggering_element['#submit'
])) { $form_state->
setSubmitHandlers($triggering_element['#submit'
]);
} // If the triggering element executes submit handlers, then set the form
// state key that's needed for those handlers to run.
if (!
empty($triggering_element['#executes_submit_callback'
])) { $form_state->
setSubmitted();
}