node.pre.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. // dsm($vars);
  3. $node = $vars['node'];
  4. $vars['theme_hook_suggestions'][] = 'node__'.$vars['view_mode'];
  5. $vars['theme_hook_suggestions'][] = 'node__' . $vars['type'] . '__' . $vars['view_mode'];
  6. $vars['print_title'] = !$vars['page'];
  7. $alias = str_replace('/', '-', drupal_get_path_alias('node/'.$vars['node']->nid));
  8. $vars['anchor_target'] = null;
  9. if($node->type == "thematique"){
  10. // $vars['id'] = $alias;
  11. // dsm($node, 'node');
  12. // $current_state = workflow_state_load_single($node->workflow);
  13. // dsm($current_state, "state");
  14. $vars['anchor_target'] = $alias;
  15. }else{
  16. $vars["classes_array"][] = $alias;
  17. $vars['id'] = "node-".$node->nid;
  18. if($vars['view_mode'] == "accueil"){
  19. $vars['print_title'] = false;
  20. }
  21. }
  22. if($node->workflow == 3){
  23. $vars["classes_array"][] = 'en_attente';
  24. }
  25. $scheduled_transitions = WorkflowScheduledTransition::load('node', $node->nid, NULL, 1);
  26. $transition = false;
  27. if(count($scheduled_transitions)){
  28. // if($node->type == "episode"){
  29. // dsm($scheduled_transitions, "scheduled_transitions");
  30. // }
  31. $transition = $scheduled_transitions[0];
  32. }
  33. $vars['wf_stamp'] = $transition ? $transition->scheduled : false;
  34. if($node->type == "episode" && $transition){
  35. // dsm($transition, "transition");
  36. // dsm($vars['content'], "content");
  37. // $vars['content']['transition'] = array(
  38. // "#type"=> "markup",
  39. // "#markup"=> format_date($transition->scheduled, 'custom', "d F Y"),
  40. // "#prefix"=>"<span class='date'>",
  41. // "#suffix"=>"</span>"
  42. // );
  43. $vars['content']['title_field'][0]['#markup'] .= "<span class='date'>".format_date($transition->scheduled, 'custom', "d F Y")."</span>";
  44. }
  45. $vars["classes_array"][] = "node-".$node->nid;