<?php

// dsm($vars);

$vars['theme_hook_suggestions'][] = 'field__' . $vars['element']['#view_mode'];
$vars['theme_hook_suggestions'][] = 'field__' . $vars['element']['#field_type'] . '__' . $vars['element']['#view_mode'];
$vars['theme_hook_suggestions'][] = 'field__' . $vars['element']['#field_name'] . '__' . $vars['element']['#view_mode'];


if($vars['element']['#field_name'] == 'field_materiau_image'){
	global $user;
	// dsm($vars);
	if(isset($user->roles[1])){
		$items = $vars['items'];
		$vars['items'] = array($items[0]);
	}
}


# this does not work because of security probleme
# http://drupal.org/node/1923554
# http://drupal.stackexchange.com/questions/63226/drupal-7-20-image-styles-return-a-url-with-access-denied
// if($vars['element']['#field_type'] == 'text_with_summary'){
// 	foreach ($vars['items'] as $key => $value) {
// 		$text = $vars['items'][$key]['#markup'];
// 		parseImagesOntext($text);
// 		$vars['items'][$key]['#markup'] = $text;
// 	}
// }
