Skip to content

Commit

Permalink
Updated place_node()
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Dewhurst committed Sep 11, 2020
1 parent d1fb1a6 commit 7462720
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Twig/TwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,17 @@ public function place_form(\Twig\Environment $env, array $context, $form_name) {
* Place a node.
*/
public function place_node(\Twig\Environment $env, array $context, $node_id, $node_view = 'full') {
$node = entity_load('node', $node_id);
$node = \Drupal::entityTypeManager()
->getStorage('node')
->load($node_id);

if (empty($node)) {
return '';
}
else {
return node_view($node, $node_view);
return \Drupal::entityTypeManager()
->getViewBuilder('node')
->view($node, $node_view);
}
}

Expand Down

0 comments on commit 7462720

Please sign in to comment.