protected function LayoutBuilderEntityViewDisplayForm::copyFormValuesToEntity in Drupal 10
Same name and namespace in other branches
- 8 core/modules/layout_builder/src/Form/LayoutBuilderEntityViewDisplayForm.php \Drupal\layout_builder\Form\LayoutBuilderEntityViewDisplayForm::copyFormValuesToEntity()
- 9 core/modules/layout_builder/src/Form/LayoutBuilderEntityViewDisplayForm.php \Drupal\layout_builder\Form\LayoutBuilderEntityViewDisplayForm::copyFormValuesToEntity()
File
- core/
modules/ layout_builder/ src/ Form/ LayoutBuilderEntityViewDisplayForm.php, line 184
Class
- LayoutBuilderEntityViewDisplayForm
- Edit form for the LayoutBuilderEntityViewDisplay entity type.
Namespace
Drupal\layout_builder\FormCode
protected function copyFormValuesToEntity(EntityInterface $entity, array $form, FormStateInterface $form_state) {
// Do not process field values if Layout Builder is or will be enabled.
$set_enabled = (bool) $form_state
->getValue([
'layout',
'enabled',
], FALSE);
/** @var \Drupal\layout_builder\Entity\LayoutEntityDisplayInterface $entity */
$already_enabled = $entity
->isLayoutBuilderEnabled();
if ($already_enabled || $set_enabled) {
$form['#fields'] = [];
$form['#extra'] = [];
}
parent::copyFormValuesToEntity($entity, $form, $form_state);
}