function epub_field_formatter_settings_form in Epub 7
File
- includes/
epub.field.inc, line 52
Code
function epub_field_formatter_settings_form($field, $instance, $view_mode, $form, &$form_state) {
$element = array();
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
switch ($display['type']) {
case 'epub_cover':
$element['width'] = array(
'#type' => 'textfield',
'#title' => t('Width'),
'#default_value' => $settings['width'] ? $settings['width'] : '100%',
'#description' => t('The width of ebook cover image.'),
);
return $element;
case 'epub_default':
$element['width'] = array(
'#type' => 'textfield',
'#title' => t('Width'),
'#default_value' => $settings['width'] ? $settings['width'] : 'auto',
'#description' => t('The width of ebook viewer area.'),
);
$element['height'] = array(
'#type' => 'textfield',
'#title' => t('Height'),
'#default_value' => $settings['height'] ? $settings['height'] : '100%',
'#description' => t('The height of ebook viewer area. If "auto" is used, the iframe will auto-fit the epub document height and anchors in links will not work correctly.'),
);
return $element;
case 'epub_js':
$element['unzipped'] = array(
'#type' => 'checkbox',
'#title' => t('Use unzipped files from epub file in the reader'),
'#default_value' => $settings['unzipped'],
'#description' => t('If unchecked, zipped epub file will be used directly in the reader. Make sure your users\' browsers can handle zip file.'),
);
$element['width'] = array(
'#type' => 'textfield',
'#title' => t('Width'),
'#default_value' => $settings['width'] ? $settings['width'] : '600px',
'#description' => t('The width of ebook reader area.'),
);
$element['height'] = array(
'#type' => 'textfield',
'#title' => t('Height'),
'#default_value' => $settings['height'] ? $settings['height'] : '100%',
'#description' => t('The height of ebook reader area.'),
);
return $element;
case 'epub_js_reader':
$element['unzipped'] = array(
'#disabled' => TRUE,
'#type' => 'checkbox',
'#title' => t('Use unzipped files from epub file in the reader'),
'#default_value' => $settings['unzipped'],
'#description' => t('If unchecked, zipped epub file will be used directly in the reader. Make sure your users\' browsers can handle zip file.'),
);
return $element;
}
return '';
}