Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
efbf061c
Commit
efbf061c
authored
14 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
#852522
by catch: Optimize file_field_load() to load filefields on all entities at once.
parent
4f28649f
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/file/file.field.inc
+5
-2
5 additions, 2 deletions
modules/file/file.field.inc
with
5 additions
and
2 deletions
modules/file/file.field.inc
+
5
−
2
View file @
efbf061c
...
...
@@ -208,16 +208,19 @@ function _file_generic_settings_file_directory_validate($element, &$form_state)
* Implements hook_field_load().
*/
function
file_field_load
(
$entity_type
,
$entities
,
$field
,
$instances
,
$langcode
,
&
$items
,
$age
)
{
$fids
=
array
();
foreach
(
$entities
as
$id
=>
$entity
)
{
// Load the files from the files table.
$fids
=
array
();
foreach
(
$items
[
$id
]
as
$delta
=>
$item
)
{
if
(
!
empty
(
$item
[
'fid'
]))
{
$fids
[]
=
$item
[
'fid'
];
}
}
$files
=
file_load_multiple
(
$fids
);
}
$files
=
file_load_multiple
(
$fids
);
foreach
(
$entities
as
$id
=>
$entity
)
{
foreach
(
$items
[
$id
]
as
$delta
=>
$item
)
{
// If the file does not exist, mark the entire item as empty.
if
(
empty
(
$item
[
'fid'
])
||
!
isset
(
$files
[
$item
[
'fid'
]]))
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment