function flexiform_ief_submit_entity_form in Flexiform 8
Ief submit callback to make sure flexiforms work in ief.
Parameters
array $entity_form: The entity form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
1 string reference to 'flexiform_ief_submit_entity_form'
- flexiform_element_info_alter in ./
flexiform.module - Implements hook_element_info_alter().
File
- ./
flexiform.module, line 69 - Allow multiple entities to be used in an entity form display.
Code
function flexiform_ief_submit_entity_form(&$entity_form, FormStateInterface $form_state) {
$inline_form_handler = InlineEntityForm::getInlineFormHandler($entity_form['#entity_type']);
$inline_form_handler
->entityFormSubmit($entity_form, $form_state);
// Submit flexiform components.
$display = FlexiformEntityFormDisplay::collectRenderDisplay($entity_form['#entity'], $entity_form['#form_mode']);
if ($display instanceof FlexiformEntityFormDisplay) {
$display
->formSubmitComponents($entity_form, $form_state);
}
// @todo: Find a way of deferring the saving of form entities to later. Possibly
// consider storing the FormEntityManager on the entity to be saved in
// a _insert or _update hook.
if ($entity_form['#save_entity']) {
$inline_form_handler
->save($entity_form['#entity']);
$display
->saveFormEntities($entity_form, $form_state);
}
}