function theme_epub_formatter_epubjs in Epub 7
1 theme call to theme_epub_formatter_epubjs()
- epub_field_formatter_view in includes/
epub.field.inc - Implements hook_field_formatter_view().
File
- includes/
epub.field.inc, line 321
Code
function theme_epub_formatter_epubjs($variables) {
global $base_url;
$filename = $variables['file']->filename;
$file_url = file_create_url($variables['file']->uri);
$path = file_create_url('public://epub_content/' . $variables['file']->fid);
if ($variables['unzipped']) {
$epub = $base_url . '/' . libraries_get_path('epub.js') . '/reader/index.html?bookPath=' . $path . '/';
}
else {
$epub = $base_url . '/' . libraries_get_path('epub.js') . '/reader/index.html?bookPath=' . $file_url;
}
$iframe = array(
'#type' => 'html_tag',
'#tag' => 'iframe',
'#value' => '',
'#attributes' => array(
'class' => array(
'epub',
'ebook',
),
'id' => array(
'fid-' . $variables['file']->fid,
),
'webkitallowfullscreen' => '',
'mozallowfullscreen' => '',
'allowfullscreen' => '',
'name' => 'epub',
'width' => $variables['width'] ? $variables['width'] : '100%',
'height' => $variables['height'] ? $variables['height'] : '600px',
'frameborder' => '0',
'src' => $epub,
),
);
$output = render($iframe);
// . l(t('Read it online'), $epub , array('attributes' => array('target'=>'_blank')));
if (file_entity_access('download', $variables['file'])) {
$output .= t('Download: ') . l($filename, $file_url) . '</div>';
}
return $output;
}