Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
de44cb8c
Commit
de44cb8c
authored
Dec 26, 2012
by
webchick
Browse files
Issue
#1827582
by dawehner: Load all nodes of comments at once.
parent
015d61bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/modules/comment/lib/Drupal/comment/CommentRenderController.php
View file @
de44cb8c
...
...
@@ -32,9 +32,18 @@ public function buildContent(array $entities = array(), $view_mode = 'full', $la
parent
::
buildContent
(
$entities
,
$view_mode
,
$langcode
);
// Load all nodes of all comments at once.
$nids
=
array
();
foreach
(
$entities
as
$entity
)
{
$node
=
node_load
(
$entity
->
nid
);
if
(
!
$node
)
{
$nids
[
$entity
->
nid
]
=
$entity
->
nid
;
}
$nodes
=
node_load_multiple
(
$nids
);
foreach
(
$entities
as
$entity
)
{
if
(
isset
(
$nodes
[
$entity
->
nid
]))
{
$node
=
$nodes
[
$entity
->
nid
];
}
else
{
throw
new
\
InvalidArgumentException
(
t
(
'Invalid node for comment.'
));
}
$entity
->
content
[
'#node'
]
=
$node
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment