0

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 ?

Charles
  • 50,943
  • 13
  • 104
  • 142
Nealv
  • 6,856
  • 8
  • 58
  • 89

1 Answers1

0

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

Vlad Stratulat
  • 1,296
  • 1
  • 10
  • 24
  • With what I am doing it is more logic to implement it in a module. – Nealv Nov 29 '11 at 15:13
  • Hmm ... since you put down-vote I wonder if this is possible to rewrite node's template with function. Will keep an eye on this question. – Vlad Stratulat Nov 29 '11 at 16:29
  • Yes, it is possible. It's what I am doing at the moment for a couple of nodes, but now I want to do it for "Display Suite", not a node. which doesn't seem to work in the same way – Nealv Nov 29 '11 at 17:05
  • So you find out how to apply template to a node with function? – Vlad Stratulat Nov 29 '11 at 17:07
  • What the function does, is register a certain template which is not in the theme folder (but for example in a module) in the registry. So this has the same effect as putting it in the theme folder. – Nealv Nov 29 '11 at 17:09
  • So you found an answer to your question? If yes, then publish your answer! At least I would know this method. – Vlad Stratulat Nov 29 '11 at 17:26
  • No, this works for "NODES" and "VIEWS" i am trying to do the same for "DISPLAY SUITE" templates – Nealv Nov 29 '11 at 17:27