// If Layout Builder is enabled on default Core display, then enable it
// here too; otherwise enable automatic processing.
if($layout_builder_default){
$ce_display->setUseLayoutBuilder(TRUE);
// In v2, a non-default view mode would use a Layout,
// * IF it does not have its own (Core) Entity View Display, or if
// its own Entity View Display has Layout Builder enabled,
// * AND IF it is not handled by a custom processor that does not
// extend DefaultContentEntityProcessor.
// It is hard to decide whether it makes more sense
// 1. whether to enable Layout Builder on the default CE display, and
// then also create CE displays with layout builder explicitly
// disabled for any view mode that needs it,
// 2. or to keep Layout Builder disabled on the default CE display,
// and CE displays with layout builder enabled for any view mode
// that needs it,
// ...because it is unknown whether entities are ever built using
// the "default" view mode explicitly. (If so, then only the first
// option is possible.) Leave it up to the user.
$logger->notice("$entity_type_id.$bundle_key has Layout Builder enabled for the 'default' view mode. Please reconsider if you:
1) want building custom elements in any view mode to default to using Layout Builder; in this case, a CE display must be added for any view mode which has its own Core Display (that doesn't use Layout Builder), OR which uses a custom processor (that does not extend DefaultContentEntityProcessor);
2) prefer building custom elements to not default to using Layout Builder; in this case, the \"Use Layout Builder\" option must be disabled on the default CE display and a CE display must be added for any view mode which should use Layout Builder.");
// Inverse of above: if the view mode is handled by a custom
// processor, then Layout Builder was likely not used in version 2,
// and we are likely fine. If it is handled by
// DefaultContentEntityProcessor or a custom processor that extends
// it, we need a CE display with Layout Builder explicitly enabled.
$logger->notice("$entity_type_id.$bundle_key has Layout Builder enabled for the '$view_mode_key' view mode. If NO custom processor is used, a CE display must still be added, with 'Layout builder' enabled. If a custom processor is using a Layout for building: check https://www.drupal.org/node/3485395.");
}
}
}
}
}
```
### API changes
Generally, the core module and its API remain unchanged. Besides that some small API changes /
simplifications have been applied. Please take a list of change records for details: