protected function ActionEditFieldForm::init in Paragraphs table 8
Initialize the form state and the entity before the first form build.
1 call to ActionEditFieldForm::init()
- ActionEditFieldForm::buildForm in src/
Form/ ActionEditFieldForm.php - Builds a form for a single entity field.
File
- src/
Form/ ActionEditFieldForm.php, line 106
Class
- ActionEditFieldForm
- Builds and process a form for editing a single entity field.
Namespace
Drupal\paragraphs_table\FormCode
protected function init(FormStateInterface $form_state, EntityInterface $entity, $field_name) {
if ($entity
->getEntityTypeId() == 'node') {
$node_type = $this->nodeTypeStorage
->load($entity
->bundle());
$entity
->setNewRevision($node_type
->shouldCreateNewRevision());
$entity->revision_log = NULL;
}
$form_state
->set('entity', $entity);
$form_state
->set('field_name', $field_name);
$display = EntityFormDisplay::collectRenderDisplay($entity, 'default');
foreach ($display
->getComponents() as $name => $options) {
if ($name != $field_name) {
$display
->removeComponent($name);
}
}
$form_state
->set('form_display', $display);
}