function social_post_photo_preprocess_image_formatter in Open Social 8.2
Same name and namespace in other branches
- 8.9 modules/social_features/social_post/modules/social_post_photo/social_post_photo.module \social_post_photo_preprocess_image_formatter()
- 8 modules/social_features/social_post/modules/social_post_photo/social_post_photo.module \social_post_photo_preprocess_image_formatter()
- 8.3 modules/social_features/social_post/modules/social_post_photo/social_post_photo.module \social_post_photo_preprocess_image_formatter()
- 8.4 modules/social_features/social_post/modules/social_post_photo/social_post_photo.module \social_post_photo_preprocess_image_formatter()
- 8.5 modules/social_features/social_post/modules/social_post_photo/social_post_photo.module \social_post_photo_preprocess_image_formatter()
- 8.6 modules/social_features/social_post/modules/social_post_photo/social_post_photo.module \social_post_photo_preprocess_image_formatter()
- 8.7 modules/social_features/social_post/modules/social_post_photo/social_post_photo.module \social_post_photo_preprocess_image_formatter()
- 8.8 modules/social_features/social_post/modules/social_post_photo/social_post_photo.module \social_post_photo_preprocess_image_formatter()
- 10.3.x modules/social_features/social_post/modules/social_post_photo/social_post_photo.module \social_post_photo_preprocess_image_formatter()
- 10.0.x modules/social_features/social_post/modules/social_post_photo/social_post_photo.module \social_post_photo_preprocess_image_formatter()
- 10.1.x modules/social_features/social_post/modules/social_post_photo/social_post_photo.module \social_post_photo_preprocess_image_formatter()
- 10.2.x modules/social_features/social_post/modules/social_post_photo/social_post_photo.module \social_post_photo_preprocess_image_formatter()
Implements hook_photo_preprocess_image_formatter().
File
- modules/
social_features/ social_post/ modules/ social_post_photo/ social_post_photo.module, line 24 - The Social post photo module.
Code
function social_post_photo_preprocess_image_formatter(&$variables) {
if ($variables['image_style'] == "social_post_photo" && empty($variables['image']['#alt'])) {
// Set the image alt to the filename.
$uri = $variables['image']['#uri'];
$alt = substr(strrchr($uri, "/"), 1);
$variables['image']['#alt'] = $alt;
}
}