protected function EntityInlineForm::buildEntity in Inline Entity Form 8
Builds an updated entity object based upon the submitted form values.
Parameters
array $entity_form: The entity form.
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
2 calls to EntityInlineForm::buildEntity()
- EntityInlineForm::entityFormSubmit in src/
Form/ EntityInlineForm.php - Handles the submission of an entity form.
- EntityInlineForm::entityFormValidate in src/
Form/ EntityInlineForm.php - Validates the entity form.
File
- src/
Form/ EntityInlineForm.php, line 300
Class
- EntityInlineForm
- Generic entity inline form handler.
Namespace
Drupal\inline_entity_form\FormCode
protected function buildEntity(array $entity_form, ContentEntityInterface $entity, FormStateInterface $form_state) {
$form_display = $this
->getFormDisplay($entity, $entity_form['#form_mode']);
$form_display
->extractFormValues($entity, $entity_form, $form_state);
// Invoke all specified builders for copying form values to entity fields.
if (isset($entity_form['#entity_builders'])) {
foreach ($entity_form['#entity_builders'] as $function) {
call_user_func_array($function, [
$entity
->getEntityTypeId(),
$entity,
&$entity_form,
&$form_state,
]);
}
}
}