1

If you have Display Suite installed, then on the "Manage Display" tab of any content type you will see template suggestions:

Possible template suggestions are:

  • ds-1col--node.tpl.php
  • ds-1col--node-page.tpl.php
  • ds-1col--node-page-search-result.tpl.php

None of these suit what I'm wanting to achieve, as I wanted a template to apply to all "search-result" view modes for any content type. So my template suggestion would be:

ds-1col--search-result.tpl.php

But it seems it's not by default accepted. Which hook can I use to add this template suggestion? I was thinking of hook_preprocess_node and adding my own template suggestion to theme_hook_suggestions but this didn't work as it wasn't using my suggestion on node types which have search_result view mode applied to them. The template was only being used on the ones without any search_result view mode configurations, and even then only normal node.tpl.php variables such as $content was passed to this DS template so I don't think it's the right way to do it.

2 Answers 2

0

The problem actually wasn't in ds-1col--search-result.tpl.php. It was when I suggested a custom template for a node when I was doing quick tests, with print $ds_content; in them, the nodes which didn't have the search_result view mode configured, weren't being preprocessed by display suite hence didn't have the $ds_content variable set which was being printed on the custom template. Hence it gave me the impression that it wasn't working.

But to answer the question, there's no special stuff you need to do to suggest a template for display suite. First copy the template from display suite folder to your themes folder. And then all you have to do is use the normal hook_process_node and suggest that template for a certain view mode.

-1

In case you have Panels installed, DisplaySuite will benefit from the numerous layouts Panels (and its extentions) have to offer. You can even choose if you want to use the DS own Field UI, or the Panels editor to arrange the fields.

If you don't have Panels installed then ignore this reply. Maybe a more specific reply will help you out.

1
  • I just want to apply a single template to all node types on search_result view mode. Instead of doing a same template file for each single node type.
    – Beebee
    Commented Jul 17, 2012 at 9:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.