Problem

#2329937: Allow definition objects to provide options is going to move providing options from field item classes to field definitions.

This API change is required to prepare making $entity optional for fetching the options of a field, i.e. you'll be able to fetch the options of the FieldStorageDefinition instead. Right now, $entity is still required, but making the required entity parameter optional later on won't be an API change.

Proposed resolution

Make field definitions as the primary API to fetch options providers now, and make it controllable by field definitions in [#2329937 later.

Remaining tasks

Do it.

User interface changes

-

API changes

To fetch e.g. the options of a list field formatters will have to do:
$field_definition->getOptionsProvider($property_name, $entity)->getAvailableOptions();
instead of the previous
$field_item->getAvailableOptions();

CommentFileSizeAuthor
#6 d8_options.patch7.84 KBfago
#6 d8_options.interdiff.txt886 bytesfago
#2 d8_options.patch7.87 KBfago

Comments

fago’s picture

Issue tags: -pre AMS +Pre-AMS beta sprint
fago’s picture

Status: Active » Needs review
StatusFileSize
new7.87 KB

Patch attached.

Status: Needs review » Needs work

The last submitted patch, 2: d8_options.patch, failed testing.

yched’s picture

FieldStorageConfig::getOptionsProvider() is right,
BaseFieldDefinition::getOptionsProvider() is wrong :-)
It's the $item that can be instanceof OptionsProviderInterface, not the $item_list

fago’s picture

Status: Needs work » Needs review

Ops, forgot to update the other implementation. Thanks for catching!

fago’s picture

StatusFileSize
new886 bytes
new7.84 KB
yched’s picture

Status: Needs review » Reviewed & tested by the community

Good if green :-)

fago’s picture

Issue summary: View changes
webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

  • webchick committed e18b616 on 8.0.x
    Issue #2346297 by fago: Move getting option providers to field...

Status: Fixed » Closed (fixed)

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