function blazy_field_formatter_info_alter in Blazy 8
Same name and namespace in other branches
- 8.2 blazy.module \blazy_field_formatter_info_alter()
Implements hook_field_formatter_info_alter().
File
- ./
blazy.module, line 74 - Provides basic Blazy integration for lazy loading and multi-serving images.
Code
function blazy_field_formatter_info_alter(array &$info) {
// Supports optional Media Entity via VEM/VEF if available.
$common = [
'description' => t('Displays lazyloaded images, or iframes, for VEF/ ME.'),
'quickedit' => [
'editor' => 'disabled',
],
'provider' => 'blazy',
];
if (blazy()
->getModuleHandler()
->moduleExists('video_embed_media')) {
$info['blazy_file'] = $common + [
'id' => 'blazy_file',
'label' => t('Blazy Image with Media'),
'class' => 'Drupal\\blazy\\Plugin\\Field\\FieldFormatter\\BlazyFileFormatter',
'field_types' => [
'entity_reference',
'image',
],
];
$info['blazy_video'] = $common + [
'id' => 'blazy_video',
'label' => t('Blazy Video'),
'class' => 'Drupal\\blazy\\Plugin\\Field\\FieldFormatter\\BlazyVideoFormatter',
'field_types' => [
'video_embed_field',
],
];
}
}