summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/field/modules/options/options.api.php7
-rw-r--r--modules/field/modules/options/options.module2
2 files changed, 7 insertions, 2 deletions
diff --git a/modules/field/modules/options/options.api.php b/modules/field/modules/options/options.api.php
index dfbb631c6..68374446e 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 385f3f47f..d4d05eca2 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);