Commit 17f76e22 authored by webchick's avatar webchick

Issue #1922892 by yched: Last missing bit from D7 '_field_info_collate_fields()' patch.

parent 0c53c63a
...@@ -1349,11 +1349,6 @@ function hook_field_storage_details_alter(&$details, $field) { ...@@ -1349,11 +1349,6 @@ function hook_field_storage_details_alter(&$details, $field) {
* Modules implementing this hook should load field values and add them to * Modules implementing this hook should load field values and add them to
* objects in $entities. Fields with no values should be added as empty arrays. * objects in $entities. Fields with no values should be added as empty arrays.
* *
* By the time this hook runs, the relevant field definitions have been
* populated and cached in FieldInfo, so calling field_info_field_by_id() on
* each field individually is more efficient than loading all fields in memory
* upfront with field_info_field_by_ids() (which is uncached).
*
* @param $entity_type * @param $entity_type
* The type of entity, such as 'node' or 'user'. * The type of entity, such as 'node' or 'user'.
* @param $entities * @param $entities
...@@ -1374,6 +1369,10 @@ function hook_field_storage_load($entity_type, $entities, $age, $fields, $option ...@@ -1374,6 +1369,10 @@ function hook_field_storage_load($entity_type, $entities, $age, $fields, $option
$load_current = $age == FIELD_LOAD_CURRENT; $load_current = $age == FIELD_LOAD_CURRENT;
foreach ($fields as $field_id => $ids) { foreach ($fields as $field_id => $ids) {
// By the time this hook runs, the relevant field definitions have been
// populated and cached in FieldInfo, so calling field_info_field_by_id()
// on each field individually is more efficient than loading all fields in
// memory upfront with field_info_field_by_ids().
$field = field_info_field_by_id($field_id); $field = field_info_field_by_id($field_id);
$field_name = $field['field_name']; $field_name = $field['field_name'];
$table = $load_current ? _field_sql_storage_tablename($field) : _field_sql_storage_revision_tablename($field); $table = $load_current ? _field_sql_storage_tablename($field) : _field_sql_storage_revision_tablename($field);
......
...@@ -356,6 +356,10 @@ function field_sql_storage_field_storage_load($entity_type, $entities, $age, $fi ...@@ -356,6 +356,10 @@ function field_sql_storage_field_storage_load($entity_type, $entities, $age, $fi
$load_current = $age == FIELD_LOAD_CURRENT; $load_current = $age == FIELD_LOAD_CURRENT;
foreach ($fields as $field_id => $ids) { foreach ($fields as $field_id => $ids) {
// By the time this hook runs, the relevant field definitions have been
// populated and cached in FieldInfo, so calling field_info_field_by_id()
// on each field individually is more efficient than loading all fields in
// memory upfront with field_info_field_by_ids().
$field = field_info_field_by_id($field_id); $field = field_info_field_by_id($field_id);
$field_name = $field['field_name']; $field_name = $field['field_name'];
$table = $load_current ? _field_sql_storage_tablename($field) : _field_sql_storage_revision_tablename($field); $table = $load_current ? _field_sql_storage_tablename($field) : _field_sql_storage_revision_tablename($field);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment