I need nodes within a certain place in my menu to use a new node TPL file.
My menu is hierarchical like this.
link1
link2
link3
-linkA
-linkB
I need nodes whose menu link is link3, linkA or linkB to use these new TPL files.
I have 2 content types whose nodes can be in the menu and I need a different TPL file for each content type. These nodes can also be outside of the menu in which case they should use the normal TPL file.
So a node of content type A which has a menu link of link1, link2 or no menu link would use the default node--typeA.tpl.php.
A node of content type A which has a menu link of link3, linkA or linkB would use node--typeA--special.tpl.php
A node of content type B which has a menu link of link1, link2 or no menu link would use the default node--typeB.tpl.php
A node of content type B which has a menu link of link3, linkA or linkB would use node--typeB--special.tpl.php
As I'm extending the node not page TPL I started with this:
function MYTHEME_preprocess_node(&$variables) {
$variables['theme_hook_suggestions'][] = 'node__SOMETHING';
kpr($variables);
}
Im assuming I need an if statement around the 2nd line which checks if the node is typeA and also in the correct place in the menu? However I had a look at the $variables on the screen and I couldn't see anything I could use to find out the menu position.
I then looked at preprocess_page to see if it had a variable I could use. There is an array called main_menu which is the name of my menu. But it contains 0 elements.
function MYTHEME_preprocess_page(&$variables) {
kpr($variables);
}