- 🇺🇸United States Peter Caritas
This is what worked for me:
Apply the patch in #19
In the .module file for my custom entity module I added the following:
/** * Implements hook_entity_type_alter(). */ function mymodule_entity_type_alter(array &$entity_types) { /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */ $entity_types['my_entity']->setLinkTemplate('auto-label', '/admin/structure/my_entity/settings/auto-label'); }
Replacing mymodule with the name of your module and my_entity with the name of the entity (and any other changes to the path to match where your entity admin lives.
- 🇬🇧United Kingdom adaddinsane
I just added this and this worked for me:
function mymodule_entity_type_alter(array &$entity_types): void { /** @var EntityTypeInterface[] $entity_types */ $entity_types['my_entity']->setLinkTemplate('auto-label', '/admin/structure/my_entity/auto-label'); }
Including "/settings" did not work.
Though if you are a developer and using custom entities then you should have access to the entity configuration so you just need to add this:
* links = { * "canonical" = "/admin/structure/my_entity/{my_entity}", * "add-form" = "/admin/structure/my_entity/add", * "edit-form" = "/admin/structure/my_entity/{my_entity}/edit", * "delete-form" = "/admin/structure/my_entity/{my_entity}/delete", * "collection" = "/admin/structure/my_entity", * "auto-label" = "/admin/structure/my_entity/auto-label", * },
which is a lot cleaner.
- 🇨🇦Canada adriancid Montreal, Canada
For custom entities #19 and #23 made the job.
- Status changed to Needs work
9 months ago 5:55pm 12 February 2024 - 🇺🇸United States JonMcL Brooklyn, NY
Potentially major problem with the else statement in this block of code:
// Special treatment for Core's user entity. if ($entity_type_id == 'user') { $widget = &$form['account']['name']; } else { $widget = &$form[$label]['widget'][0]['value']; }
Not all entity form displays are going to have a label field in the form. Assigning a non-existent form element to $widget by reference actually created the element with a value of null;
Problem is that
ContentEntityForm::copyFormValuesToEntity
then gets called and because the label widget was added to the form (with a value of null), ::copyFormValuesToEntity then sets the label to be null.This is probably a problem only when auto_entitylabel is disabled for a particular entity type and when the label widget is not present in the form currently being submitted.
- Status changed to Needs review
9 months ago 6:49pm 12 February 2024 - last update
6 months ago Composer error. Unable to continue. - 🇺🇸United States joegraduate Arizona, USA
Re-rolled patch from #19 against latest 8.x-3.x branch. The existing patch no longer applied after the latest changes included in the 8.x-3.2 release.
- Merge request !26Issue #2945387 by Pancho, Pasqualle, dkosbob, joegraduate, bdimaggio: Support entities without bundles (User, etc.) → (Open) created by joegraduate
- last update
5 months ago Composer error. Unable to continue.