Here I needed to change a tag inside an image. the 'foaf:Image' and replace it with a default tag instead. Here's my code.
function MYTHEME_preprocess_image(&$variables) {
$image_attributes_array = $variables['attributes']['typeof'];
if ( in_array('foaf:Image', $image_attributes_array )) {
foreach ($image_attributes_array as $key => $image_attribute) {
if ( $image_attribute == 'foaf:Image') {
// start: find out what filetype the image is and make a tag accordingly
$image_file_type_array = explode('.', $variables['path']);
$image_file_type = end($image_file_type_array);
$tag = 'image/' . $image_file_type;
// end:
$variables['attributes']['typeof'][$key] = $tag;
}
}
}
}
If you're interested in the post you may be intereseted in ' SEO Drupal Best Practice '
No comments:
Post a Comment