📌  相关文章
📜  drupal 8 以编程方式呈现节点 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:32.583000             🧑  作者: Mango

代码示例1
$nid = 1;
$entity_type = 'node';
$view_mode = 'teaser';

$view_builder = \Drupal::entityTypeManager()->getViewBuilder($entity_type);
$storage = \Drupal::entityTypeManager()->getStorage($entity_type);
$node = $storage->load($nid);
$build = $view_builder->view($node, $view_mode);