How can I pass parameters to allowed_values_function for a field? Tried these 3 ways... none of them work.

-&gt;setSettings(array(
    'allowed_values' =&gt; array(),
    'allowed_values_function' =&gt; '\Drupal\xrm_core\Util\DefinedValuesListUtil::getRegionValues',
    'allowed_values_function_arguments' =&gt; '["country_id", 0]',
  ))

  -&gt;setSettings(array(
    'allowed_values' =&gt; array(),
    'allowed_values_function' =&gt; '\Drupal\xrm_core\Util\DefinedValuesListUtil::getRegionValues(1)',
  ))

  -&gt;setSettings(array(
    'allowed_values' =&gt; array(),
    'allowed_values_function' =&gt; '\Drupal\xrm_core\Util\DefinedValuesListUtil::getRegionValues\1',
  ))


This particular feature seems totaly undocumented in existing drupal docs. Any ideas to point me in the right direction please?
It's undocumented because it's not possible with core classes.

The options.api.php file refers to that callback as follows:


  That function will be called:
  
  
  either in the context of a specific entity, which is then provided as the $entity parameter,
  or for the field generally without the context of any specific entity or entity bundle (typically, Views needing a list of values for an exposed filter), in which case the $entity parameter is NULL.
  


There's no mention of being able to pass arbitrary parameters along to it. Indeed if you look at the invocation in options_allowed_values

$function = $definition-&gt;getSetting('allowed_values_function');
...
$values = $function($definition, $entity, $cacheable);


You can see that there's no scope for passing extra params at all. 

Hopefully you'll be able to get the required context from the entity, otherwise you'll need to find another way to make it available to your callback function.