summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmitai Burstein2013-04-13 19:25:06 (GMT)
committer Amitai Burstein2013-04-13 19:25:06 (GMT)
commitffa0fd252283c54f6595c5989dc91c9fcedfa32e (patch)
tree7958b5b02d4ecee5faf094b6b56177731fb0585a
parent250b861dcca837a1c26b2b4542b1c32af66fc09f (diff)
Fix caching.
-rw-r--r--entityreference_prepopulate.module21
1 files changed, 16 insertions, 5 deletions
diff --git a/entityreference_prepopulate.module b/entityreference_prepopulate.module
index d8c37bc..59b138b 100644
--- a/entityreference_prepopulate.module
+++ b/entityreference_prepopulate.module
@@ -195,13 +195,24 @@ function entityreference_prepopulate_get_values($entity_type, $entity, $field, $
$field_name = $field['field_name'];
- if (module_exists('og') && og_is_group_audience_field($field_name) && empty($instance['field_mode'])) {
- // Group audience field, but no field-mode provided.
- return;
+ $cache = &drupal_static(__FUNCTION__, array());
+ $identifier = array(
+ $instance['entity_type'],
+ $instance['bundle'],
+ $field_name,
+ );
+
+ if (module_exists('og') && og_is_group_audience_field($field_name)) {
+ if (empty($instance['field_mode'])) {
+ // Group audience field, but no field-mode provided.
+ return;
+ }
+ $identifier[] = $instance['field_mode'];
+
}
- $cache = &drupal_static(__FUNCTION__, array());
- $identifier = $instance['entity_type'] . ':' . $instance['bundle'] . ':' . $field_name;
+ $identifier = implode(',', $identifier);
+
if (isset($cache[$identifier])) {
return $cache[$identifier];
}