Skip to content
Snippets Groups Projects
Commit 17f76e22 authored by Angie Byron's avatar Angie Byron
Browse files

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

parent 0c53c63a
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -1349,11 +1349,6 @@ function hook_field_storage_details_alter(&$details, $field) {
* 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.
*
* 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
* The type of entity, such as 'node' or 'user'.
* @param $entities
......@@ -1374,6 +1369,10 @@ function hook_field_storage_load($entity_type, $entities, $age, $fields, $option
$load_current = $age == FIELD_LOAD_CURRENT;
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_name = $field['field_name'];
$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
$load_current = $age == FIELD_LOAD_CURRENT;
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_name = $field['field_name'];
$table = $load_current ? _field_sql_storage_tablename($field) : _field_sql_storage_revision_tablename($field);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment