View source
<?php
function opigno_pdf_viewer_install() {
$field = field_info_field('slide_pdf');
if (empty($field)) {
field_create_field(array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'slide_pdf',
'foreign keys' => array(
'fid' => array(
'columns' => array(
'fid' => 'fid',
),
'table' => 'file_managed',
),
),
'indexes' => array(
'fid' => array(
0 => 'fid',
),
),
'locked' => 0,
'module' => 'file',
'settings' => array(
'display_default' => 0,
'display_field' => 0,
'uri_scheme' => 'public',
),
'translatable' => 0,
'type' => 'file',
));
}
$instance = field_info_instance('node', 'slide_pdf', 'quiz_directions');
if (empty($instance)) {
field_create_instance(array(
'bundle' => 'quiz_directions',
'deleted' => 0,
'description' => 'The file uploaded here will be displayed inside the slide',
'display' => array(
'default' => array(
'label' => 'hidden',
'module' => 'pdf',
'settings' => array(
'height' => '600px',
'keep_pdfjs' => TRUE,
'width' => '100%',
),
'type' => 'pdf_default',
'weight' => 2,
),
'teaser' => array(
'label' => 'hidden',
'module' => 'pdf',
'settings' => array(
'height' => '600px',
'keep_pdfjs' => 1,
'width' => '100%',
),
'type' => 'pdf_default',
'weight' => 1,
),
'question' => array(
'label' => 'hidden',
'module' => 'pdf',
'settings' => array(
'height' => '600px',
'keep_pdfjs' => 1,
'width' => '100%',
),
'type' => 'pdf_default',
'weight' => 10,
),
),
'entity_type' => 'node',
'field_name' => 'slide_pdf',
'label' => 'PDF',
'required' => 0,
'settings' => array(
'description_field' => 0,
'file_directory' => '',
'file_extensions' => 'pdf',
'max_filesize' => '',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'file',
'settings' => array(
'progress_indicator' => 'throbber',
),
'type' => 'file_generic',
'weight' => -3,
),
));
}
}
function opigno_pdf_viewer_install_translations() {
t('The file uploaded here will be displayed inside the slide');
t('PDF');
}