summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEarl Miles2011-09-07 19:13:48 (GMT)
committer Earl Miles2011-09-07 19:13:48 (GMT)
commitb4c2887fc19342ad6ebd37edbb4c9b55b3be84de (patch)
tree4a2e647964a6a70fb561ecc5401ecfd38f2a1a5f
parent452ab7cc573a4033786e06f59f6170208560a9a8 (diff)
Issue #1243686 by das-peter: Add static caching to entity from context relationship children.
-rw-r--r--plugins/relationships/entity_from_field.inc7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/relationships/entity_from_field.inc b/plugins/relationships/entity_from_field.inc
index e5e6582..1bba270 100644
--- a/plugins/relationships/entity_from_field.inc
+++ b/plugins/relationships/entity_from_field.inc
@@ -25,6 +25,12 @@ function ctools_entity_from_field_get_child($plugin, $parent, $child) {
}
function ctools_entity_from_field_get_children($parent_plugin, $parent) {
+ $cid = $parent_plugin['name'] . ':' . $parent;
+ $cache = &drupal_static(__FUNCTION__);
+ if (!empty($cache[$cid])) {
+ return $cache[$cid];
+ }
+
ctools_include('fields');
$entities = entity_get_info();
$plugins = array();
@@ -154,6 +160,7 @@ function ctools_entity_from_field_get_children($parent_plugin, $parent) {
}
drupal_alter('ctools_entity_contexts', $plugins);
+ $cache[$cid] = $plugins;
return $plugins;
}