Skip to main content
added 72 characters in body
Source Link
Beebee
  • 6.9k
  • 2
  • 34
  • 56

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.

And also when I dpm'd $vars['theme_hook_suggestions'], the display suite The template suggestions were not there (not sure if it's module weight issue)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 it didn't seem likeI don't think it's the right placeway to add display suite theme suggestionsdo it.

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.

And also when I dpm'd $vars['theme_hook_suggestions'], the display suite template suggestions were not there (not sure if it's module weight issue), so it didn't seem like the right place to add display suite theme suggestions.

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.

Source Link
Beebee
  • 6.9k
  • 2
  • 34
  • 56

How to add more Display Suite template suggestions

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.

And also when I dpm'd $vars['theme_hook_suggestions'], the display suite template suggestions were not there (not sure if it's module weight issue), so it didn't seem like the right place to add display suite theme suggestions.