function template_preprocess_bxslider_ths in BxSlider 8
Preprocess function.
File
- ./
bxslider.module, line 161 - BxSlider integration.
Code
function template_preprocess_bxslider_ths(&$variables) {
template_preprocess_bxslider($variables);
foreach ($variables['thumbnail_items'] as $key => $item) {
if (!empty($variables['settings']['thumbnail_slider']['thumbnail_style'])) {
$variables['thumbnails'][$key]['image'] = [
'#theme' => 'image_style',
'#style_name' => $variables['settings']['thumbnail_slider']['thumbnail_style'],
];
}
else {
$variables['thumbnails'][$key]['image'] = [
'#theme' => 'image',
];
}
if (($entity = $item->entity) && empty($item->uri)) {
$variables['thumbnails'][$key]['image']['#uri'] = $entity
->getFileUri();
}
else {
$variables['thumbnails'][$key]['image']['#uri'] = $item->uri;
}
}
// Add additional class to a thumbnail wrapper.
$default_wrapper_class = !empty($variables['settings']['thumbnail_slider']['wrapperClass']) ? $variables['settings']['thumbnail_slider']['wrapperClass'] : 'bx-wrapper';
$variables['#attached']['drupalSettings']['bxslider_ths'][$variables['settings']['slider_id']]['thumbnail_slider']['wrapperClass'] = $default_wrapper_class . ' bx-wrapper__ths';
}