I want to add a record do theme_hook_suggestions variable but only when specific conditions are met, especially when system is going to use a specific template in theme. In effect I want to replace one template with other.
I.e. - when user sees node with id = 50 and view mode == teaser and user has set some specific parameters system should use template node-special.tpl.php. In any other condition system should use base template node-50.tpl.php
I cannot do this, as far as I understand, in any *preprocess or *process functions basing on variables because there is no information available about what template are candidate for use.
How can I achieve this?
EDIT, more detailed explanation:
I'm trying to build a A/B testing system for e-commerce site I run. I want to set a A/B test where for selected base template a new variant will be defined and for chosen group of users this new variant will be used. I want to have a universal solution where I could configure this just by one line of code. It should work both for nodes, fields, blocks, pages templates. I just simply need to substitute one template field with another.
ie I want to have a universal config:
$ABconfig = array( 'ABbigrelated' => array( //test name 'basetemplate' => 'related-nodes', //base template 'newtemplate' => 'related-nodes-bigimages', //new template 'GAdimensions' => 'dimension2' //config for googleanalitics ) );