function EmbeddedForm::buildForm
Same name in other branches
- 10 core/modules/field_layout/tests/modules/field_layout_test/src/Form/EmbeddedForm.php \Drupal\field_layout_test\Form\EmbeddedForm::buildForm()
Overrides FormInterface::buildForm
File
-
core/
modules/ field_layout/ tests/ modules/ field_layout_test/ src/ Form/ EmbeddedForm.php, line 31
Class
- EmbeddedForm
- Provides the EmbeddedForm class.
Namespace
Drupal\field_layout_test\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$form['foo'] = [
'#type' => 'fieldset',
'#title' => $this->t('Wrapper'),
'#tree' => TRUE,
'#parents' => [
'foo',
],
];
$entity = EntityTest::load(1);
if ($entity) {
if ($entity) {
$display = EntityFormDisplay::collectRenderDisplay($entity, 'default');
$subform_state = SubformState::createForSubform($form['foo'], $form, $form_state);
$display->buildForm($entity, $form['foo'], $subform_state);
\Drupal::classResolver(FieldLayoutBuilder::class)->buildForm($form['foo'], $display, $subform_state);
}
}
return $form;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.