protected function ActionEditFieldForm::buildEntity in Paragraphs table 8
Returns a cloned entity containing updated field values.
Calling code may then validate the returned entity, and if valid, transfer it back to the form state and save it.
2 calls to ActionEditFieldForm::buildEntity()
- ActionEditFieldForm::submitForm in src/
Form/ ActionEditFieldForm.php - Saves the entity with updated values for the edited field.
- ActionEditFieldForm::validateForm in src/
Form/ ActionEditFieldForm.php - Form validation handler.
File
- src/
Form/ ActionEditFieldForm.php, line 153
Class
- ActionEditFieldForm
- Builds and process a form for editing a single entity field.
Namespace
Drupal\paragraphs_table\FormCode
protected function buildEntity(array $form, FormStateInterface $form_state) {
/** @var \Drupal\Core\Entity\EntityInterface $entity */
$entity = clone $form_state
->get('entity');
$field_name = $form_state
->get('field_name');
$form_state
->get('form_display')
->extractFormValues($entity, $form, $form_state);
if ($entity
->getEntityTypeId() == 'node' && $entity
->isNewRevision() && $entity->revision_log
->isEmpty()) {
$entity->revision_log = t('Updated the %field-name field through in-place editing.', [
'%field-name' => $entity
->get($field_name)
->getFieldDefinition()
->getLabel(),
]);
}
return $entity;
}