Problem/Motivation
#2989889: Extract DraggableListBuilderTrait from DraggableListBuilder for use with content entities caused a regression for entities with a NULL weight, as DraggableListBuilder::getWeight() is type-hinted to return an int|float value, but it returns NULL in that case.
Steps to reproduce
- Create a new taxonomy vocabulary (so that the drag-and-drop interface gets enabled), let's say you called it
foo - Run
drush cset taxonomy.vocabulary.foo weight --input-format=yaml '~' - Visit the vocabulary overview
See the following exception:
TypeError: Drupal\Core\Config\Entity\DraggableListBuilder::getWeight(): Return value must be of type int|float, null returned in Drupal\Core\Config\Entity\DraggableListBuilder->getWeight() (line 39 of core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php).
Proposed resolution
Add a fallback to 0 in DraggableListBuilder::getWeight().
Remaining tasks
Review MR.
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
-
Issue fork drupal-3425058
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
tstoecklerComment #4
andypostThank you!
Comment #5
alexpottCommitted and pushed a957a4acfc to 11.x and d4565e1788 to 10.3.x. Thanks!