EntityFormDisplay shouldn't assume a field weight

Created on 4 February 2016, almost 9 years ago
Updated 15 December 2023, about 1 year 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 2 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.j.johnson@gmail.com 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.71.5 2024