Problem/Motivation

Followup for #2015689: Convert field type to typed data plugin for options module and part of #3566536: [meta] eliminate core .module files

Proposed resolution

  • Deprecate options_allowed_values() and move its logic to a new Drupal\options\OptionsAllowedValuesInterface service
  • Deprecate drupal_static_reset('options_allowed_values') calls.
  • Deprecate _options_values_in_use() and move the logic to a new protected method \Drupal\options\Hook\OptionsHooks::hasValuesInUse(). No replacement is provided.

Remaining tasks

None.

User interface changes

None.

Introduced terminology

None.

API changes

See Proposed resolution

Data model changes

None.

Issue fork drupal-2171397

Command icon 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

yched’s picture

Issue tags: +Entity Field API
plopesc’s picture

Moving the code from options_allowed_values() to ListItemBase::getSettableOptions() does not make any problem.

However, options_allowed_values() is also called from Drupal\field\Plugin\views\argument\FieldList and Drupal\field\Plugin\views\argument\ListString, where I was unable to access to ListItemBase::getSettableOptions().

We could duplicate the code in those view plugins, but this looks weird IMHO. Or maybe create a service which could be accessible both both places. Or there is a hidden way to access to the Field Item from the view plugins I'm unable to find...

Any thoughts?

Regards.

dawehner’s picture

However, options_allowed_values() is also called from Drupal\field\Plugin\views\argument\FieldList and Drupal\field\Plugin\views\argument\ListString, where I was unable to access to ListItemBase::getSettableOptions().

It seems to be that making this method protected was kind of wrong?

yched’s picture

@dawehner - hmm, there's no protected method here ?

Well, views calls options_allowed_values() without the non-optionnal second argument (and rightfully so, there is no known $entity in this calling context...). So it's probably not working anyway...

Actually, that's probably tied to #2012130: Regression: Views integration for "list" field types is broken, which I haven't followed in a while :-/

(also, it's a bit weird that those two FieldList and ListString classes are almost 1:1 duplicates ?)

plopesc’s picture

So, should we postpone this issue on #2012130: Regression: Views integration for "list" field types is broken or maybe move the function to ListItemBase::getSettableOptions() and manage the allowed values issue in views there?

yched’s picture

Status: Active » Postponed

Postponing sounds safer IMO. Sorry for pointing you to a deadend issue @plopesc :-)

sun’s picture

Status: Postponed » Needs review
Issue tags: +API clean-up
Parent issue: » #1862656: Move field type modules out of Field API module
StatusFileSize
new9.98 KB

Huh. Am I missing something?

Status: Needs review » Needs work

The last submitted patch, 7: drupal8.options-allowed-values.7.patch, failed testing.

sun’s picture

Status: Needs work » Needs review
StatusFileSize
new9.98 KB

Oops.

Status: Needs review » Needs work

The last submitted patch, 9: drupal8.options-allowed-values.9.patch, failed testing.

sun’s picture

OK, I guess I assumed we'd have made more progress on the Entity Field API DX by now ;-)

Not sure how to resolve these:

Fatal error: Call to undefined method Drupal\field\Entity\FieldConfig::isValueInUse()
  in core/modules/options/options.module on line 51

Fatal error: Call to undefined method Drupal\Core\Field\ConfigFieldItemList::getAllowedValues()
  in core/modules/options/lib/Drupal/options/Plugin/Field/FieldFormatter/OptionsDefaultFormatter.php on line 34

It looks like $field can be a ListItemBase, FieldConfig, or ConfigFieldItemList, depending on what exactly the code in context understands under $field? :P ;)

yched’s picture

@sun :
You're adding a getAllowedValues() method on ListItemBase, i.e an object like $entity->field_name[0]
But then you're calling it on:
- (in the views handlers) a FieldDefininitionInterface object, i.e field_info_field($e_t, $field_name) or $entity->field_name->getFieldDefinition()
- (in OptionsDefaultFormatter) a FieldItemList, i.e an object like $entity->field_name
So yeah, Call to undefined method :-)

Note that the View case is one of the challenges : it needs a list of allowed values for the field without having an actual entity, and thus without a FieldItem object. So if the getAllowedValues() method lives on the FieldItem class, it needs to be a static.

It looks like $field can be a ListItemBase, FieldConfig, or ConfigFieldItemList

When EntityNG was introduced, it masively used $field variables to refer to field values ($entity->field_name), while the "old" Field API masively used $field to refer to field definitions (field_info_field()).
Naming conventions have been agreed upon since then: $field_items / $items for values, $field_definition for definitions.
The code has been progressively updated to reflect those naming conventions, but it's very likely that there are remnants, we usually try fix them when we see them.

I don't see where the ambiguity would be in the code involved in the patch though ?

andypost’s picture

This function blocks "merge Drupal\options\Plugin\Field\FieldType\ListBooleanItem into Drupal\Core\Field\Plugin\Field\FieldType\BooleanItem"

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

claudiu.cristea’s picture

Version: 8.6.x-dev » 8.8.x-dev
Issue tags: +@deprecated
Related issues: +#1577902: [META] Remove all usages of drupal_static() & drupal_static_reset()

This fulfills #1577902: [META] Remove all usages of drupal_static() & drupal_static_reset() regarding removal of drupal_static() & Co. from options_allowed_values().

andypost’s picture

Issue tags: +Needs reroll
plopesc’s picture

StatusFileSize
new13.74 KB

Hello,

I tried to work today on this issue. It seems that finally I got something workable, but it's been more complex than expected. The fact that FieldStorageDefinitionInterface::getOptionsProvider() method requires to pass an entity made it quite hard in the Views situation, where the entity was not directly available.

Also the fact that requiring an instance of ListItemBase to have access to that options that can be directly accessible from the fieldStorage made it a bit tricky.

Not sure if this is the best approach or maybe we could try to use a service or similar that could manage the options allowed values.

Attaching a prrof of concept path. Let's see if testbot agrees.

Regards

plopesc’s picture

Status: Needs work » Needs review

Updating issue status

plopesc’s picture

StatusFileSize
new13.72 KB

Attaching a new version. Last one had the wrong base path.

Sorry for the noise.

Status: Needs review » Needs work

The last submitted patch, 24: 2171397-allowed-values-24.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

plopesc’s picture

Status: Needs work » Needs review
Related issues: +#2012130: Regression: Views integration for "list" field types is broken
StatusFileSize
new14.22 KB
new2.13 KB

New version trying to solve issues found by testbot.

Status: Needs review » Needs work

The last submitted patch, 26: 2171397-allowed-values-26.patch, failed testing. View results

plopesc’s picture

Status: Needs work » Needs review
StatusFileSize
new15.6 KB
new2.73 KB

New try fixing tests.

Status: Needs review » Needs work

The last submitted patch, 28: 2171397-allowed-values-28.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

plopesc’s picture

Status: Needs work » Needs review
StatusFileSize
new15.85 KB
new2.19 KB

Another try

aleevas’s picture

Issue tags: -Needs reroll
berdir’s picture

+++ b/core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php
@@ -58,15 +92,14 @@ public function getSettableValues(AccountInterface $account = NULL) {
   public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
-    $allowed_options = options_allowed_values($field_definition->getFieldStorageDefinition());
+    $allowed_options = $field_definition->getSetting('allowed_values');
     $values['value'] = array_rand($allowed_options);
     return $values;

this does mean we lose the ability to use this function in combination with a allowed values callback?

Also, looks like the cacheable-feature was removed.

And I don't think the approach you have with views is feasible, the APi was defined for entity to be optional.

Maybe a static method or a service as you suggested would be better.

plopesc’s picture

Hello,

Thank you for your review. As mentioned in my last comment, this approach is not the best and needs some improvements in order to get the final solution.

Regarding your comments:

this does mean we lose the ability to use this function in combination with a allowed values callback?

We did not use the allowed values callback in that situation because the method is defined at the ListItemBase level and in that method I don't have access to it, so the less bad solution was to use the allowed values property.

Also, looks like the cacheable-feature was removed.

Given that we store the allowed values as a property at the ListItemBase level, I believe it's not necessary to add the cache layer.

And I don't think the approach you have with views is feasible, the APi was defined for entity to be optional.

It is optional in the current APi, but if we rely on the FieldStorageDefinitionInterface::getOptionsProvider(), it is now required. In the issue where it was introduced, it was commented that it could be optional in the future. However, it has not happened yet.

Maybe a static method or a service as you suggested would be better.

Agree, otherwise I think we would have to break so many things to have this in place.

Do you have any idea? Some discussion or guidance would be much appreciated.

plopesc’s picture

StatusFileSize
new12 KB

Hi,

Here is a new patch following a simpler approach as a proof of concept. Just replace options_allowed_values with a service that behaves in the same way.

Of course, it would require some cleanup, but just throwing the idea to start the discussion.

Status: Needs review » Needs work

The last submitted patch, 34: 2171397-allowed-values-34.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

plopesc’s picture

Status: Needs work » Needs review
StatusFileSize
new12.31 KB

Sorry, forgot to add the new file to the patch.

idebr’s picture

The related issue #1909744: Allow adding predefined lists to the options fields via plugins implements a plugin manager for predefined list that provides the same DX as the current options_allowed_values()

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

hardik_patel_12’s picture

StatusFileSize
new12.35 KB
new584 bytes

Updating deprecating message drupal:8.8.0 and will be removed from drupal:9.0.0 to drupal:9.1.0 and will be removed from drupal:10.0.0

heddn’s picture

Linking #3161345: options_allowed_values() cache pollution, which would effect what we're working on here.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

berdir’s picture

Status: Needs review » Needs work
  1. +++ b/core/modules/options/src/Plugin/views/argument/NumberListField.php
    @@ -35,7 +35,8 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o
     
         $field_storage = $this->getFieldStorageDefinition();
    -    $this->allowedValues = options_allowed_values($field_storage);
    +    $this->allowedValues = $allowed_options = \Drupal::service('options.allowed_values')->allowedValues($field_storage);
    +
    

    the local variable doesn't do anything it seems, the method is over after this.

  2. +++ b/core/modules/options/src/Plugin/views/argument/StringListField.php
    @@ -34,7 +34,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o
         parent::init($view, $display, $options);
     
         $field_storage = $this->getFieldStorageDefinition();
    -    $this->allowedValues = options_allowed_values($field_storage);
    +    $this->allowedValues = $allowed_options = \Drupal::service('options.allowed_values')->allowedValues($field_storage);
    

    same.

Also the usual deprecation version updates.

dhirendra.mishra’s picture

Status: Needs work » Needs review
StatusFileSize
new2.08 KB
new12.31 KB

I have re-rolled it against 9.3.x and fix from #44.
Kindly review it

berdir’s picture

Status: Needs review » Needs work

See coding standard issues linked on "Custom Commands Failed".

ankithashetty’s picture

Status: Needs work » Needs review
StatusFileSize
new12.42 KB
new1.86 KB

Tried fixing custom command failure errors, thanks!

joachim’s picture

Status: Needs review » Needs work

Looks good overall, but:

+++ b/core/modules/options/src/Plugin/Field/FieldType/ListItemBase.php
@@ -55,7 +55,7 @@ public function getSettableValues(AccountInterface $account = NULL) {
+    $allowed_options = \Drupal::service('options.allowed_values')->allowedValues($this->getFieldDefinition()->getFieldStorageDefinition(), $this->getEntity());

All of these calls to the new service should have it injected into the plugin.

geek-merlin’s picture

@plopesc #33:

The current patch essentially moves code from a function to a static method, which is IMHO not the idea of the original IS.

but if we rely on the FieldStorageDefinitionInterface::getOptionsProvider(), it is now required. In the issue where it was introduced, it was commented that it could be optional in the future. However, it has not happened yet.

I think that this (FieldStorageDefinitionInterface::getOptionsProvider()) is the way to go, rather than last patch. Or du i miss something?

vsujeetkumar’s picture

Status: Needs work » Needs review
StatusFileSize
new12.48 KB
new653 bytes

Fixed the "custom command fail issue", I am not sure that link is correct, Please have a look and advise.

berdir’s picture

+++ b/core/modules/options/options.module
@@ -71,7 +71,7 @@
- * @see callback_allowed_values_function()
+ * @see https://www.drupal.org/project/drupal/issues/2171397

so the drupalci check expects the next @see after @deprecated to be a link to the change record. We could still keep the old reference as long as it's below the URL.

The URL would need to go the change record though, and not this issue.

\Drupal\Core\Field\FieldStorageDefinitionInterface::getOptionsProvider() has a required $entity argument, while this service does not. I don't think that it is possible to online the implementation directly into \Drupal\options\Plugin\Field\FieldType\ListItemBase::getSettableOptions() because getting a list item object without an entity is very tricky and would require to create a dummy content entity at runtime for e.g. views filters. All the calls in the options.module views filter/argument plugins do not pass an entity and can't do so.

I don't see a problem with having this as a separate service, seems like the only feasible option?

berdir’s picture

Status: Needs review » Needs work

Re #48: typed data plugins do not support DI. But views plugins do, see below.

  1. +++ b/core/modules/options/src/OptionsAllowedValues.php
    @@ -0,0 +1,61 @@
    +  /**
    +   * Array containing the cached allowed values.
    +   *
    +   * @var array
    +   */
    +  protected $allowedValues;
    

    "Array containing" seems a but superfluous, suggestion: "Cached allowed values, keyed by field target type, field name and whether or not an entity was provided as context"

  2. +++ b/core/modules/options/src/OptionsAllowedValuesInterface.php
    @@ -0,0 +1,42 @@
    +   *
    +   * The strings are not safe for output. Keys and values of the array should be
    +   * sanitized through \Drupal\Core\Field\AllowedTagsXssTrait::fieldFilterXss()
    ...
    +   *
    

    this description needs to be synced with what's on options_allowed_values(), this trait doesn't exist anymore.

  3. +++ b/core/modules/options/src/OptionsAllowedValuesInterface.php
    @@ -0,0 +1,42 @@
    +   *
    +   * @see callback_allowed_values_function()
    +   */
    +  public function allowedValues(FieldStorageDefinitionInterface $definition, FieldableEntityInterface $entity = NULL);
    

    I'd suggest to use getAllowedValues(), I think we're going away from methods that have that shortened way. Helps to make it clear that it returns that value and doesn't set or something.

  4. +++ b/core/modules/options/src/Plugin/views/argument/NumberListField.php
    @@ -35,7 +35,8 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o
     
         $field_storage = $this->getFieldStorageDefinition();
    -    $this->allowedValues = options_allowed_values($field_storage);
    +    $this->allowedValues = \Drupal::service('options.allowed_values')->allowedValues($field_storage);
    

    the views filter plugins could use DI.

dhirendra.mishra’s picture

StatusFileSize
new2.57 KB
new13.98 KB

Worked on points 1 and 4 (DI) from #52.
Other points still need work...
Hopefully it helps somewhere...

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

claudiu.cristea’s picture

claudiu.cristea’s picture

Assigned: Unassigned » claudiu.cristea
Issue tags: +Needs issue summary update, +Needs change record
  • Working on this
  • Converted #53 to a MR (no changes, verbatim)
  • Hide patches
  • Adding tags

nicxvan’s picture

It'd expand this to both remaining functions probably

nicxvan’s picture

Title: Move options_allowed_values() to a method somewhere ? » Deprecate remaining options.module functions
nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

Issue summary: View changes
claudiu.cristea’s picture

Assigned: claudiu.cristea » Unassigned
Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs issue summary update, -Needs change record

Ready for review.

claudiu.cristea’s picture

Issue summary: View changes
smustgrave’s picture

Status: Needs review » Needs work

Sorry this one appears to need a rebase please.

claudiu.cristea’s picture

Status: Needs work » Needs review

Created #3583435: PP-1 Deprecate/remove ListItemBase::submitFieldStorageUpdate() as followup which is blocked on this.

Ready for a new review

smustgrave’s picture

Looks good to me but will let nicxvan mark it as he’s been more involved in the review already

nicxvan’s picture

Status: Needs review » Reviewed & tested by the community

I think this is ready now!

This one is surprisingly complex and there is one follow up.

Deprecations are the correct versions and consistent.

Only thing that might be worth thinking about is OptionsAllowedValuesInterface, but it might make sense to allow that to be swapped out.

New files have declare(strict_types=1);

larowlan’s picture

Status: Reviewed & tested by the community » Needs review

We had a broader plan for how to tackle this in #2329937: Allow definition objects to provide options as part of the D8 entity API lifecycle.

We just never got time to finish it - but the API over there still sounds very solid.

In this issue we're moving the legacy function and introducing OptionsAllowedValuesInterface which is another API we will have to support/deprecate if we ever finish that work.

Was any consideration given to moving the logic of OptionsAllowedValues internal to ListItemBase::getSettableOptions and making that the new permanent API we replace `options_allowed_values` with?

Then the views plugins could use `$this->getFieldStorageDefinition()->getOptionsProvider()->getSettableOptions()` instead of injecting the new service.

I'll ping @fago for his thoughts.

nicxvan’s picture

Yes, in fact that was the original approach, looks like it was pivoted in 34 due to 32 and 33.

oily’s picture

Ran the manual 'test-only' test. Output:

https://git.drupalcode.org/issue/drupal-2171397/-/jobs/9261107

LGTM.

nicxvan’s picture

Thank you @oily, however, running test only is only really helpful for Bugs. This is a Task the test only fails because the new service that was created no longer exists, not because there is a specific test tracking something.

We don't need to run test only for Tasks.

oily’s picture

@nicxvan Okay, thank you for the reminder. I misinterpreted the output, too.

nicxvan’s picture

No problem!

nicxvan’s picture

I went through 32-34 in more detail and I think it's talking about the second parameter in options_allowed_values(FieldStorageDefinitionInterface $definition, ?FieldableEntityInterface $entity = NULL)

Looking in contrib about half or more of the calls seem to be without the optional parameter, putting it on ListItemBase essentially makes this required.
https://search.tresbien.tech/search?q=options_allowed_values

The views comment also seems accurate too, but I'm less sure I understood that correctly.

larowlan’s picture

Re #78 thoughts then on emitting a deprecation error from the new interface if $entity is not passed?
That gives us a chance to move to the desired API in a subsequent major.

smustgrave’s picture

Should this be NW for the latest feedback?

nicxvan’s picture

Status: Needs review » Needs work

Yes