field.pre.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. // dsm($vars);
  3. $element = $vars['element'];
  4. $vm = $element['#view_mode'];
  5. $ft = $element['#field_type'];
  6. $fn = $element['#field_name'];
  7. $b = $element['#bundle'];
  8. $vars['theme_hook_suggestions'][] = 'field__' . $vm;
  9. $vars['theme_hook_suggestions'][] = 'field__' . $ft . '__' . $vm;
  10. $vars['theme_hook_suggestions'][] = 'field__' . $fn . '__' . $vm;
  11. $vars['theme_hook_suggestions'][] = 'field__' . $fn . '__' . $vm;
  12. $vars['theme_hook_suggestions'][] = 'field__' . $b . '__' . $fn . '__' . $vm;
  13. $vars['theme_hook_suggestions'][] = 'field__' . $b . '__' . $fn;
  14. if($fn == 'body' && $b == 'thematique'){
  15. $vars['items'][0] = array(
  16. 'summary' =>array(
  17. "#type"=>"markup",
  18. "#markup"=>$element['#items'][0]['safe_summary'],
  19. "#prefix"=>"<div class='summary'>",
  20. "#suffix"=>"</div>",
  21. )
  22. );
  23. if($vm == 'accueil' ){
  24. $vars['items'][0]['value'] = array(
  25. "#type"=>"markup",
  26. "#markup"=>$element['#items'][0]['safe_value'],
  27. "#prefix"=>"<div class='value'>",
  28. "#suffix"=>"</div>",
  29. );
  30. }
  31. }