EntityFormDisplay shouldn't assume a field weight

Created on 4 February 2016, over 8 years ago
Updated 15 December 2023, 6 months ago

\Drupal\Core\Entity\Entity\EntityFormDisplay::buildForm and \Drupal\Core\Entity\Entity\EntityFormDisplay::processForm both assume that a field has a weight set, it shouldn't.

This patch sets the weight to 0 if one is not set.

πŸ› Bug report
Status

Closed: duplicate

Version

9.4

Component
EntityΒ  β†’

Last updated about 7 hours ago

Created by

πŸ‡¬πŸ‡§United Kingdom timmillwood 🏴󠁧󠁒󠁷󠁬󠁳󠁿 Wales, UK

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¨πŸ‡¦Canada Laura Johnson Toronto

    For anyone looking to suppress this warning until the related issue lands, this is the patch that's working for me. Similar to the one posted except it needs the null coalescing operator:

    $element[$name]['#weight'] = $options['weight'] ?? 0

Production build 0.69.0 2024