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.
Method Drupal\Core\Field\Plugin\Field\FieldWidget\OptionsWidgetBase::getSelectedOptions(FieldItemListInterface $items, $delta = 0) doesn't use the second argument. The method doc is not clear, it contains description of the argument, but the argument is not mentioned in method description or return value description.
I'm ready to provide patch, but I don't know do I remove the argument from the method signiture, or do I update the method body to return single item value if the argument is set (and change the default value to $delta = -1).
Comment | File | Size | Author |
---|---|---|---|
#3 | 2644554-3.patch | 1.84 KB | sergei_brill |
Comments
Comment #2
swentel CreditAttribution: swentel commentedHmm interesting, OptionsSelectWidget calls it with the $delta argument, but it's not doing anything indeed.
It was introduced in #1758622: Provide the options list of an entity field, but got removed in #2346297: Move getting option providers to field definitions
It's kind of useless now, so I guess we can simply remove it.
Comment #3
sergei_brill CreditAttribution: sergei_brill commentedComment #4
ellishettinga CreditAttribution: ellishettinga commentedThe patch was applied without problems and the three references to 'delta' were cleanly removed by it
Comment #5
alexpottAs this is removing a parameter we've decided to only do this in 8.1.x. Committed e53bf1f and pushed to 8.1.x. Thanks!
Comment #7
jibranI know @swentel commented on the issue but we should've waited for @yched's opinion. We are changing the signature of the function here so it is a BC break atleast for DER see
DynamicEntityReferenceOptionsTrait::getSelectedOptions
. I think we should revert this.