function media_crop_media_token_to_markup_alter in Media crop 7
Implements hook_media_token_to_markup_alter().
File
- ./
media_crop.module, line 1018 - Media crop primary module file.
Code
function media_crop_media_token_to_markup_alter(&$element, $tag_info, $settings) {
if ($tag_info['view_mode'] === 'media_crop' && $tag_info['file']->type === 'image') {
$element['#attributes']['class'] = array(
'media-image',
);
$media_crop_settings = $tag_info['attributes'];
foreach ($media_crop_settings as $name => $value) {
if (_startsWith($name, 'media_crop_')) {
$element['#attributes']['class'][] = 'attr__' . $name . '__' . $value;
$element['#media_crop'][$name] = $value;
}
}
$element['#theme'] = 'media_crop_image';
}
}