function lazy_is_field_enabled in Lazy-load 7
Is any of the image fields using the `Lazy-load image` formatter?
File
- ./
lazy.module, line 183 - Module file for Lazy-load.
Code
function lazy_is_field_enabled() {
$lazy_enabled_fields = array();
$field_map = field_info_field_map();
foreach ($field_map as $field_name => $field) {
if ($field['type'] === 'image') {
foreach ($field['bundles'] as $entity_type => $bundle) {
$field_instance = field_info_instance($entity_type, $field_name, $bundle[0]);
foreach ($field_instance['display'] as $display_name => $display) {
if ($field_instance['display'][$display_name]['type'] === 'lazy') {
$lazy_enabled_fields[] = implode('-', array(
$field_instance['entity_type'],
$field_instance['field_name'],
$display_name,
));
}
}
}
}
}
return (bool) count($lazy_enabled_fields);
}