0

I'm looking for a solution to migrate content between environments (dev->staging->production) and currently I think I'll use UUID and Node Export (as far as I see UUID Features is still in alpha and isn't recommended by the community).

Sometimes I want to use template files or hooks (e.g. theme_preprocess_node) specific to a node created on my dev and then to upload the changes to production - this thing is impossible with the use of nids, but must be possible with uuids. Is there any way out of the box to add theme_hook_suggestions by uuid, or do I need to implement it on my theme?

Thanks.

1 Answer 1

1

You should add a hook in your template.php, like this:

function MYTHEME_preprocess_node(&$vars) {        
  if ($vars['node']->uuid == '12345') {
    $vars['theme_hook_suggestions'][] = 'my-best-tpl';
  }        
}
2
  • Now I don't remember if it's $vars['node'] or $vars['#node'] :)
    – arrubiu
    Sep 11, 2013 at 9:27
  • It is $vars['node']. I ended up adding this line $vars['theme_hook_suggestions'][] = 'node__' . strtr($vars['uuid'],'-', '_'); , so I guess there isn't an 'out of the box' functionality to do it. Thanks any way :)
    – rreiss
    Sep 11, 2013 at 9:39

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.