function epub_field_formatter_view in Epub 7
Implements hook_field_formatter_view().
File
- includes/
epub.field.inc, line 142
Code
function epub_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
$element = array();
$settings = $display['settings'];
switch ($display['type']) {
case 'epub_cover':
foreach ($items as $delta => $item) {
$element[$delta] = array(
'#theme' => 'epub_formatter_cover',
'#file' => (object) $item,
'#width' => $settings['width'],
);
}
break;
case 'epub_default':
foreach ($items as $delta => $item) {
$element[$delta] = array(
'#theme' => 'epub_formatter_default',
'#file' => (object) $item,
'#width' => $settings['width'],
'#height' => $settings['height'],
);
}
break;
case 'epub_toc':
foreach ($items as $delta => $item) {
$element[$delta] = array(
'#theme' => 'epub_formatter_toc',
'#file' => (object) $item,
);
}
break;
case 'epub_js':
foreach ($items as $delta => $item) {
$element[$delta] = array(
'#theme' => 'epub_formatter_epubjs',
'#file' => (object) $item,
'#unzipped' => $settings['unzipped'],
'#width' => $settings['width'],
'#height' => $settings['height'],
);
}
break;
case 'epub_js_reader':
foreach ($items as $delta => $item) {
$element[$delta] = array(
'#theme' => 'epub_formatter_epubjs_reader',
'#file' => (object) $item,
'#unzipped' => $settings['unzipped'],
);
}
break;
}
return $element;
}