function lazy_field_formatters in Lazy-load 8.3
Supported field formatters that Lazy-load can be enabled.
Other modules can override this list of the field formatters via a `hook_lazy_field_formatters_alter(&$formatters)` hook.
Return value
array Returns a list of field formatters that supports lazy-loading.
2 calls to lazy_field_formatters()
File
- ./
lazy.module, line 47 - Module file for Lazy-load.
Code
function lazy_field_formatters() {
$formatters = [];
$moduleHandler = \Drupal::moduleHandler();
if ($moduleHandler
->moduleExists('colorbox')) {
$formatters[] = 'colorbox';
}
if ($moduleHandler
->moduleExists('image')) {
$formatters[] = 'image';
$formatters[] = 'lazy_image';
}
if ($moduleHandler
->moduleExists('media')) {
$formatters[] = 'media_thumbnail';
}
if ($moduleHandler
->moduleExists('responsive_image')) {
$formatters[] = 'responsive_image';
$formatters[] = 'lazy_responsive_image';
}
\Drupal::service('module_handler')
->alter('lazy_field_formatters', $formatters);
$formatters = array_values(array_unique($formatters));
return $formatters;
}