Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
As long as function node_view:
// We don't need duplicate rendering info in node->content.
// We don't need duplicate rendering info in node->content.
unset($node->content);
$build += array(
'#theme' => 'node',
'#node' => $node,
'#view_mode' => $view_mode,
);
$node->content won't be defined in $variables['elements']['#node'] so this comprobation is uselesS:
if (!empty($node->in_preview)) {
unset($node->content['links']);
}
Comment | File | Size | Author |
---|---|---|---|
#3 | unneeded-if.patch | 817 bytes | bleen |
#2 | template_preprocess_node.patch | 690 bytes | jherencia |
template_preprocess_node.patch | 711 bytes | jherencia | |
Comments
Comment #2
jherencia CreditAttribution: jherencia commentedReroll.
Comment #3
bleen CreditAttribution: bleen commentedI can confirm that when $node->in_preview == TRUE, there is no $node->content so this check is unnecessary
reroll...
Comment #5
tobiasb#3: unneeded-if.patch queued for re-testing.
Comment #6
moshe weitzman CreditAttribution: moshe weitzman commentedThe code we are removing does serve a purpose. Namely, it tries to remove node links during a Preview. That’s done because you can't actually add a comment and so on to a node thats not been created yet. Seems like the code is acting on the wrong variable though.
I'm fine with removing this, since removing node links during Preview is pretty edge case anyway.
Comment #7
sunCan be backported later.
Comment #8
catchtagging for backport.
Comment #9
jherencia CreditAttribution: jherencia commentedPatch works for both branches.
Comment #10
Dries CreditAttribution: Dries commentedCommitted to 7.x and 8.x.
(Working from the road so can't review big complex issues right now -- picking away some smaller patches that are unlikely to break bigger patches.)