commit 2d0f608bc7240e6dd2bdbbe276e4b4a2ecc1f378 Author: Damien Tournoud Date: Wed Oct 19 12:06:39 2011 +0200 #1066274 diff --git a/modules/field/modules/options/options.api.php b/modules/field/modules/options/options.api.php index dfbb631..6837444 100644 --- a/modules/field/modules/options/options.api.php +++ b/modules/field/modules/options/options.api.php @@ -15,6 +15,11 @@ * * @param $field * The field definition. + * @param $instance + * (optional) The instance definition. The hook might be called without an + * $instance parameter in contexts where no specific instance can be targeted. + * It is recommended to only use instance level properties to filter out + * values from a list defined by field level properties. * * @return * The array of options for the field. Array keys are the values to be @@ -25,7 +30,7 @@ * widget. The HTML tags defined in _field_filter_xss_allowed_tags() are * allowed, other tags will be filtered. */ -function hook_options_list($field) { +function hook_options_list($field, $instance = NULL) { // Sample structure. $options = array( 0 => t('Zero'), diff --git a/modules/field/modules/options/options.module b/modules/field/modules/options/options.module index 385f3f4..d4d05ec 100644 --- a/modules/field/modules/options/options.module +++ b/modules/field/modules/options/options.module @@ -231,7 +231,7 @@ function _options_properties($type, $multiple, $required, $has_value) { */ function _options_get_options($field, $instance, $properties) { // Get the list of options. - $options = (array) module_invoke($field['module'], 'options_list', $field); + $options = (array) module_invoke($field['module'], 'options_list', $field, $instance); // Sanitize the options. _options_prepare_options($options, $properties);