Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
$default_display = EntityFormDisplay::load('user.user.default');
$register_display = $default_display->createCopy('register');
The user.user.default form display is created by the "standard' profile, and it also exists in Umami.
Anyone running the minimal profile won't have it, so the second line is not guaranteed to work.
Comments
Comment #2
bojanz CreditAttribution: bojanz at Centarro commentedWe'll need some boilerplate cause #2367933: Move entity_get_(form_)display() to the entity display repository was fixed only for Drupal 8.8.x:
Comment #4
bojanz CreditAttribution: bojanz at Centarro commentedDone.