field.pre.php 977 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. // dsm($vars);
  3. $vars['theme_hook_suggestions'][] = 'field__' . $vars['element']['#view_mode'];
  4. $vars['theme_hook_suggestions'][] = 'field__' . $vars['element']['#field_type'] . '__' . $vars['element']['#view_mode'];
  5. $vars['theme_hook_suggestions'][] = 'field__' . $vars['element']['#field_name'] . '__' . $vars['element']['#view_mode'];
  6. if($vars['element']['#field_name'] == 'field_materiau_image'){
  7. global $user;
  8. // dsm($vars);
  9. if(isset($user->roles[1])){
  10. $items = $vars['items'];
  11. $vars['items'] = array($items[0]);
  12. }
  13. }
  14. # this does not work because of security probleme
  15. # http://drupal.org/node/1923554
  16. # http://drupal.stackexchange.com/questions/63226/drupal-7-20-image-styles-return-a-url-with-access-denied
  17. // if($vars['element']['#field_type'] == 'text_with_summary'){
  18. // foreach ($vars['items'] as $key => $value) {
  19. // $text = $vars['items'][$key]['#markup'];
  20. // parseImagesOntext($text);
  21. // $vars['items'][$key]['#markup'] = $text;
  22. // }
  23. // }