fotorama_gallery.module in Fotorama Gallery 8
Same filename and directory in other branches
Add new formatter display to image field.
File
fotorama_gallery.moduleView source
<?php
/**
* @file
* Add new formatter display to image field.
*/
/**
* Implements hook_theme().
*/
function fotorama_gallery_theme() {
return [
'fotorama_gallery_field' => [
'render element' => 'element',
],
];
}
/**
* Implements template_preprocess_fotorama_gallery_field().
*/
function template_preprocess_fotorama_gallery_field(&$variables, $hook) {
$element = $variables['element'];
$variables['label_hidden'] = $element['#label_display'] == 'hidden';
// Always set the field label - allow themes to decide whether to display it.
// In addition the label should be rendered but hidden to support screen
// readers.
$variables['label'] = $element['#title'];
$variables['multiple'] = $element['#is_multiple'];
$variables['items'] = [];
$delta = 0;
while (!empty($element[$delta])) {
$variables['items'][$delta]['content'] = $element[$delta];
$delta++;
}
$variables['attributes'] = $variables['element']['attributes'];
}
Functions
Name | Description |
---|---|
fotorama_gallery_theme | Implements hook_theme(). |
template_preprocess_fotorama_gallery_field | Implements template_preprocess_fotorama_gallery_field(). |