模块中的 Drupal 显示套件模板

发布于 2024-12-18 11:13:52 字数 779 浏览 4 评论 0原文

我正在使用此函数在模块中注册 tpl 文件。

/**
 * Implementation of hook_theme().
 */
function frontpage_carousel_theme($existing) {
    return array(
        'ds_1col' => array(
            'arguments' => array(),
            'template' => 'ds-1col--node-carousel-carousel',
            'original hook' => 'ds_1col__node',
            'path' => drupal_get_path('module', 'frontpage_carousel') . '/templates',
            'type' => 'module',
            'preprocess functions' => array('template_preprocess', 'template_preprocess'),
        ),
    );
}

这工作正常,但用于每个节点。我想仅将其应用于 ds-1col--node-carousel-carousel.tpl.php,但

return array(
            'ds_1col__node_carousel_carousel' => array(

不起作用。有人有想法吗?

I am using this function to register a tpl file in a module.

/**
 * Implementation of hook_theme().
 */
function frontpage_carousel_theme($existing) {
    return array(
        'ds_1col' => array(
            'arguments' => array(),
            'template' => 'ds-1col--node-carousel-carousel',
            'original hook' => 'ds_1col__node',
            'path' => drupal_get_path('module', 'frontpage_carousel') . '/templates',
            'type' => 'module',
            'preprocess functions' => array('template_preprocess', 'template_preprocess'),
        ),
    );
}

this works fine, but is used for every node. I would like to apply it only to ds-1col--node-carousel-carousel.tpl.php, but

return array(
            'ds_1col__node_carousel_carousel' => array(

does not work. Does anyone have an idea ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谜泪 2024-12-25 11:13:52

如果您想重写特定的节点类型模板,您应该使用主题文件夹中的 node--nodetype.tpl.php 文件。

If you want to rewrite specific node-type template you should use node--nodetype.tpl.php file in your theme's folder.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文