Issue #1621356 by oriol_e9g, joachim, tim.plunkett, dsdeiz: Pass all the parameters of hook_options_list() to options_list_callback

merge-requests/26/head
stefan.r 2017-01-29 18:19:53 -05:00
parent 6d92c0c1a7
commit ffe9f9178b
2 changed files with 13 additions and 3 deletions

View File

@ -8,7 +8,7 @@
/**
* Allowed values callback.
*/
function list_test_allowed_values_callback($field) {
function list_test_allowed_values_callback($field, $instance, $entity_type, $entity) {
$values = array(
'Group 1' => array(
0 => 'Zero',

View File

@ -1493,7 +1493,7 @@ function taxonomy_field_widget_info_alter(&$info) {
*/
function taxonomy_options_list($field, $instance, $entity_type, $entity) {
$function = !empty($field['settings']['options_list_callback']) ? $field['settings']['options_list_callback'] : 'taxonomy_allowed_values';
return $function($field);
return $function($field, $instance, $entity_type, $entity);
}
/**
@ -1646,10 +1646,20 @@ function taxonomy_field_formatter_view($entity_type, $entity, $field, $instance,
*
* @param $field
* The field definition.
* @param $instance
* The instance definition. It is recommended to only use instance level
* properties to filter out values from a list defined by field level
* properties.
* @param $entity_type
* The entity type the field is attached to.
* @param $entity
* The entity object the field is attached to, or NULL if no entity
* exists (e.g. in field settings page).
*
* @return
* The array of valid terms for this field, keyed by term id.
*/
function taxonomy_allowed_values($field) {
function taxonomy_allowed_values($field, $instance, $entity_type, $entity) {
$options = array();
foreach ($field['settings']['allowed_values'] as $tree) {
if ($vocabulary = taxonomy_vocabulary_machine_name_load($tree['vocabulary'])) {