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).

CommentFileSizeAuthor
#3 2644554-3.patch1.84 KBsergei_brill
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sergei_brill created an issue. See original summary.

swentel’s picture

Priority: Minor » Normal

Hmm 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.

sergei_brill’s picture

Status: Active » Needs review
FileSize
1.84 KB
ellishettinga’s picture

Status: Needs review » Reviewed & tested by the community

The patch was applied without problems and the three references to 'delta' were cleanly removed by it

alexpott’s picture

Version: 8.0.x-dev » 8.1.x-dev
Status: Reviewed & tested by the community » Fixed

As 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!

  • alexpott committed e53bf1f on 8.1.x
    Issue #2644554 by sergei_brill: Second argument of method...
jibran’s picture

I 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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.