summaryrefslogtreecommitdiff
path: root/modules/field/field.attach.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-08-01 19:49:35 +0000
committerDries Buytaert <dries@buytaert.net>2010-08-01 19:49:35 +0000
commit1d48f07fc70e7b4af344f0729eec679b7c139664 (patch)
tree54663a99a88cf4fe73a86ff10bf18cb57d587d6e /modules/field/field.attach.inc
parentd58e32ed2b20dcda35958d76faafbae673d404a4 (diff)
downloadbrdo-1d48f07fc70e7b4af344f0729eec679b7c139664.tar.gz
brdo-1d48f07fc70e7b4af344f0729eec679b7c139664.tar.bz2
- Patch #869350 by chx, yched: some field functions are called a bit too often.
Diffstat (limited to 'modules/field/field.attach.inc')
-rw-r--r--modules/field/field.attach.inc6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/field/field.attach.inc b/modules/field/field.attach.inc
index faa8743c2..ed732329c 100644
--- a/modules/field/field.attach.inc
+++ b/modules/field/field.attach.inc
@@ -273,6 +273,7 @@ function _field_invoke_multiple($op, $entity_type, $entities, &$a = NULL, &$b =
'language' => NULL,
);
$options += $default_options;
+ $field_info = field_info_field_by_ids();
$fields = array();
$grouped_instances = array();
@@ -296,7 +297,7 @@ function _field_invoke_multiple($op, $entity_type, $entities, &$a = NULL, &$b =
foreach ($instances as $instance) {
$field_id = $instance['field_id'];
$field_name = $instance['field_name'];
- $field = field_info_field_by_id($field_id);
+ $field = $field_info[$field_id];
$function = $options['default'] ? 'field_default_' . $op : $field['module'] . '_field_' . $op;
if (function_exists($function)) {
// Add the field to the list of fields to invoke the hook on.
@@ -583,6 +584,7 @@ function field_attach_form($entity_type, $entity, &$form, &$form_state, $langcod
* non-deleted fields are operated on.
*/
function field_attach_load($entity_type, $entities, $age = FIELD_LOAD_CURRENT, $options = array()) {
+ $field_info = field_info_field_by_ids();
$load_current = $age == FIELD_LOAD_CURRENT;
// Merge default options.
@@ -660,7 +662,7 @@ function field_attach_load($entity_type, $entities, $age = FIELD_LOAD_CURRENT, $
}
// Collect the storage backend if the field has not been loaded yet.
if (!isset($skip_fields[$field_id])) {
- $field = field_info_field_by_id($field_id);
+ $field = $field_info[$field_id];
$storages[$field['storage']['type']][$field_id][] = $load_current ? $id : $vid;
}
}