Problem/Motivation
I am working on Layout Builder integration with CiviCRM Entity. We have bundles, but they are not config entities. They are defined via the bundles hook.
When enabling Layout Builder and accessing the manage layout form, we receive a 404. I believe this is the offending code:
// If the entity type has no bundles and it doesn't use {bundle} in its
// admin path, use the entity type.
if (strpos($path, '{bundle}') === FALSE) {
if (!$entity_type->hasKey('bundle')) {
$defaults['bundle'] = $entity_type_id;
}
else {
$defaults['bundle_key'] = $entity_type->getBundleEntityType();
}
}
The bundle_key comes from getBundleEntityType not the bundle key itself. The current code causes the defaults for the route to be null since it's not a bundle entity type.
Steps to reproduce
Enable Layout Builder for an entity that has non-entity bundles.
Proposed resolution
Get the key from the entity type.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3208272
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mglamanNevermind, this just sets it for FieldUi. The problem would bubble into there. I found a workaround by altering the route.