summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmitai Burstein2013-04-14 18:01:54 (GMT)
committer Amitai Burstein2013-04-14 18:01:54 (GMT)
commitfccad28577e1b129d54634c002cb7b9f4a7c95dd (patch)
treec25fb561370bbd91487c21efccdb0000929dba9e
parent146c0ac642f1bbe51b1f80fe83903ce72eda96ed (diff)
Fix entityreference_prepopulate_get_values_from_cache.1958800
-rw-r--r--entityreference_prepopulate.module17
1 files changed, 11 insertions, 6 deletions
diff --git a/entityreference_prepopulate.module b/entityreference_prepopulate.module
index f005a41..68f5d44 100644
--- a/entityreference_prepopulate.module
+++ b/entityreference_prepopulate.module
@@ -264,24 +264,29 @@ function entityreference_prepopulate_get_values($field, $instance, $validate = T
}
/**
- * Helper function to get the values from the URL or cached form.
+ * Get the values from the cached form.
*
- * @param $field_name
- * The field name.
+ * @param $field
+ * The field info array.
* @param $instance
- * The field instnace.
+ * The instance info array.
+ *
+ * @see
+ * entityreference_prepopulate_get_values()
*/
-function entityreference_prepopulate_get_values_from_cache($field_name, $instance) {
+function entityreference_prepopulate_get_values_from_cache($field, $instance) {
// Try to get the form out of cache.
if (!$form_build_id = isset($_GET['form_build_id']) ? $_GET['form_build_id'] : isset($_POST['form_build_id']) ? $_POST['form_build_id'] : NULL) {
return;
}
+ $field_name = $field['field_name'];
+
$form_state = array();
form_get_cache($form_build_id, $form_state);
// If successful, get the value from the form_state.
- return isset($form_state['entityreference_prepopulate'][$instance['entity_type']][$instance['bundle']][$field_name]) ? isset($form_state['entityreference_prepopulate'][$instance['entity_type']][$instance['bundle']][$field_name]) : FALSE;
+ return isset($form_state['entityreference_prepopulate'][$instance['entity_type']][$instance['bundle']][$field_name]) ? $form_state['entityreference_prepopulate'][$instance['entity_type']][$instance['bundle']][$field_name] : FALSE;
}
/**