function _bootstrap_carousel_process in bootstrap_carousel 7
Prepares the item description and format for storage.
1 call to _bootstrap_carousel_process()
- bootstrap_carousel_field_presave in ./
bootstrap_carousel.module - Implements hook_field_presave().
File
- ./
bootstrap_carousel.module, line 149 - Bootstrap carousel module hooks.
Code
function _bootstrap_carousel_process(&$item, $delta, $field, $entity) {
$item['format'] = $item['carousel_caption']['format'];
$item['carousel_caption'] = $item['carousel_caption']['value'];
if (!empty($item['carousel_image'])) {
// Load the file via file.fid.
$file = file_load($item['carousel_image']);
// Change status to permanent.
$file->status = FILE_STATUS_PERMANENT;
// Save.
file_save($file);
// Record that the module (in this example, user module) is using the file.
file_usage_add($file, 'bootstrap_carousel', 'bootstrap_carousel_image', $item['carousel_image']);
}
}