我实现了一个HOOK_module_theme_suggestions_node_alter来添加一个定制的小枝模板。下面是我的代码
function gf_theme_module_theme_suggestions_node_alter(array &$suggestions, array $variables) {
$suggestions[] = 'node--products-template--simple';
}现在它确实出现在检查器中,但是即使文件存在,页面也不使用我添加的自定义细枝文件。有什么想法吗?
下面是截图


我已经清空了我的缓存,但还是没有运气。即使存在node.html.twig,它仍然在加载node--products-template--simple.html.twig。该文件与node.html.twig文件位于同一个文件夹中。
发布于 2022-03-17 05:16:05
在建议中使用下划线而不是连字符:
$suggestions[] = 'node__products_template__simple';https://stackoverflow.com/questions/71225396
复制相似问题