function print_pdf_settings in Printer, email and PDF versions 5.3
Same name and namespace in other branches
- 5.4 print_pdf/print_pdf.admin.inc \print_pdf_settings()
- 6 print_pdf/print_pdf.admin.inc \print_pdf_settings()
- 7.2 print_pdf/print_pdf.admin.inc \print_pdf_settings()
- 7 print_pdf/print_pdf.admin.inc \print_pdf_settings()
- 5.x print_pdf/print_pdf.admin.inc \print_pdf_settings()
Menu callback for the PDF version module settings form.
See also
3 string references to 'print_pdf_settings'
- print_pdf_menu in print_pdf/
print_pdf.module - Implementation of hook_menu().
- print_pdf_uninstall in print_pdf/
print_pdf.install - Implementation of hook_uninstall().
- print_pdf_update_6000 in print_pdf/
print_pdf.install - Update to version 6.x-1.0
File
- print_pdf/
print_pdf.admin.inc, line 17 - Contains the administrative functions of the PDF version module.
Code
function print_pdf_settings() {
$pdf_tools = _print_pdf_tools();
if ($pdf_tools != -1) {
$form['settings'] = array(
'#type' => 'fieldset',
'#title' => t('PDF options'),
);
$form['settings']['print_pdf_pdf_tool'] = array(
'#type' => 'radios',
'#title' => t('PDF generation tool'),
'#options' => $pdf_tools,
'#default_value' => variable_get('print_pdf_pdf_tool', PRINT_PDF_PDF_TOOL_DEFAULT),
'#description' => t('This option selects the PDF generation tool being used by this module to create the PDF version.'),
'#required' => TRUE,
);
$form['settings']['print_pdf_link_pos'] = array(
'#type' => 'checkboxes',
'#title' => t('PDF version link'),
'#default_value' => variable_get('print_pdf_link_pos', array(
PRINT_PDF_LINK_POS_DEFAULT => PRINT_PDF_LINK_POS_DEFAULT,
)),
'#options' => array(
'link' => t('Links area'),
'corner' => t('Content corner'),
),
'#description' => t('Choose the location of the link(s) to the PDF version. The Links area is usually below the node content, whereas the Content corner is placed in the upper-right corner of the node content. Unselect all options to disable the link. Even if the link is disabled, you can still view the PDF version of a node by going to !path/nid where nid is the numeric id of the node.', array(
'!path' => PRINTPDF_PATH,
)),
);
$form['settings']['adv_link'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced link options'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['settings']['adv_link']['print_pdf_show_link'] = array(
'#type' => 'radios',
'#title' => t('Link style'),
'#default_value' => variable_get('print_pdf_show_link', PRINT_PDF_SHOW_LINK_DEFAULT),
'#options' => array(
1 => t('Text only'),
2 => t('Icon only'),
3 => t('Icon and Text'),
),
'#description' => t('Select the visual style of the link.'),
);
$form['settings']['adv_link']['print_pdf_node_link_visibility'] = array(
'#type' => 'radios',
'#title' => t('Link visibility'),
'#default_value' => variable_get('print_pdf_node_link_visibility', PRINT_PDF_NODE_LINK_VISIBILITY_DEFAULT),
'#options' => array(
t('Show on every page except the listed pages.'),
t('Show on only the listed pages.'),
),
);
$form['settings']['adv_link']['print_pdf_node_link_pages'] = array(
'#type' => 'textarea',
'#default_value' => variable_get('print_pdf_node_link_pages', PRINT_PDF_NODE_LINK_PAGES_DEFAULT),
'#rows' => 3,
'#description' => t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array(
'%blog' => 'blog',
'%blog-wildcard' => 'blog/*',
'%front' => '<front>',
)),
);
$form['settings']['adv_link']['print_pdf_link_class'] = array(
'#type' => 'textfield',
'#title' => t('Link class'),
'#default_value' => variable_get('print_pdf_link_class', PRINT_PDF_LINK_CLASS_DEFAULT),
'#size' => 60,
'#maxlength' => 250,
'#description' => t('This can be used by themers to change the link style or by jQuery modules to open in a new window (e.g. greybox or thickbox). Multiple classes can be specified, separated by spaces.'),
);
$form['settings']['adv_link']['print_pdf_sys_link_visibility'] = array(
'#type' => 'radios',
'#title' => t('Show link in system (non-content) pages'),
'#default_value' => variable_get('print_pdf_sys_link_visibility', PRINT_PDF_SYS_LINK_VISIBILITY_DEFAULT),
'#options' => array(
t('Show on every page except the listed pages.'),
t('Show on only the listed pages.'),
),
);
$form['settings']['adv_link']['print_pdf_sys_link_pages'] = array(
'#type' => 'textarea',
'#default_value' => variable_get('print_pdf_sys_link_pages', PRINT_PDF_SYS_LINK_PAGES_DEFAULT),
'#rows' => 3,
'#description' => t('Setting this option will add a PDF version page link on pages created by Drupal or the enabled modules.') . '<br />' . t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array(
'%blog' => 'blog',
'%blog-wildcard' => 'blog/*',
'%front' => '<front>',
)),
);
$form['settings']['adv_link']['print_pdf_link_use_alias'] = array(
'#type' => 'checkbox',
'#title' => t('Use URL alias instead of node ID'),
'#default_value' => variable_get('print_pdf_link_use_alias', PRINT_PDF_LINK_USE_ALIAS_DEFAULT),
'#description' => t('Enabling this will create the link using the URL alias instead of the node ID.'),
);
$form['settings']['print_pdf_book_link'] = array(
'#type' => 'checkbox',
'#title' => t('Show link in book nodes'),
'#default_value' => variable_get('print_pdf_book_link', PRINT_PDF_BOOK_LINK_DEFAULT),
'#description' => t('Activate this to add a PDF version link in book nodes. Requires the (core) book module.'),
);
$form['settings']['print_pdf_content_disposition'] = array(
'#type' => 'radios',
'#title' => t('Open PDF in'),
'#options' => array(
t('Same browser window'),
t('New browser window'),
t('Save dialog'),
),
'#default_value' => variable_get('print_pdf_content_disposition', PRINT_PDF_CONTENT_DISPOSITION_DEFAULT),
'#description' => t("Select the desired method for opening the PDF in the user's browser."),
);
$form['settings']['print_pdf_paper_size'] = array(
'#type' => 'select',
'#title' => t('Paper size'),
'#options' => array(
'4A0' => '4A0',
'2A0' => '2A0',
'A0' => 'A0',
'A1' => 'A1',
'A2' => 'A2',
'A3' => 'A3',
'A4' => 'A4',
'A5' => 'A5',
'A6' => 'A6',
'A7' => 'A7',
'A8' => 'A8',
'A9' => 'A9',
'A10' => 'A10',
'B0' => 'B0',
'B1' => 'B1',
'B2' => 'B2',
'B3' => 'B3',
'B4' => 'B4',
'B5' => 'B5',
'B6' => 'B6',
'B7' => 'B7',
'B8' => 'B8',
'B9' => 'B9',
'B10' => 'B10',
'C0' => 'C0',
'C1' => 'C1',
'C2' => 'C2',
'C3' => 'C3',
'C4' => 'C4',
'C5' => 'C5',
'C6' => 'C6',
'C7' => 'C7',
'C8' => 'C8',
'C9' => 'C9',
'C10' => 'C10',
'RA0' => 'RA0',
'RA1' => 'RA1',
'RA2' => 'RA2',
'RA3' => 'RA3',
'RA4' => 'RA4',
'SRA0' => 'SRA0',
'SRA1' => 'SRA1',
'SRA2' => 'SRA2',
'SRA3' => 'SRA3',
'SRA4' => 'SRA4',
'LETTER' => 'Letter',
'LEGAL' => 'Legal',
'EXECUTIVE' => 'Executive',
'FOLIO' => 'Folio',
),
'#default_value' => variable_get('print_pdf_paper_size', PRINT_PDF_PAPER_SIZE_DEFAULT),
'#description' => t('Choose the paper size of the generated PDF.'),
);
$form['settings']['print_pdf_page_orientation'] = array(
'#type' => 'select',
'#title' => t('Page orientation'),
'#options' => array(
'portrait' => t('Portrait'),
'landscape' => t('Landscape'),
),
'#default_value' => variable_get('print_pdf_page_orientation', PRINT_PDF_PAGE_ORIENTATION_DEFAULT),
'#description' => t('Choose the page orientation of the generated PDF.'),
);
$form['settings']['print_pdf_font_family'] = array(
'#type' => 'textfield',
'#title' => t('Font Family'),
'#default_value' => variable_get('print_pdf_font_family', PRINT_PDF_FONT_FAMILY_DEFAULT),
'#size' => 60,
'#maxlength' => 250,
'#description' => t('(TCPDF only) Set the font family to be used. Examples: %examples.', array(
'%examples' => 'helvetica, times, courier, dejavusans, dejavuserif, freesans, freeserif, freemono',
)) . '<br />' . t("CAUTION: TCPDF embeds the complete font in the generated PDF. If you're not using Unicode, then helvetica or times are safe choices that will keep the PDF small. Unicode fonts can increase the size of the PDF to the 1MB region."),
);
$form['settings']['print_pdf_font_size'] = array(
'#type' => 'textfield',
'#title' => t('Font Size'),
'#default_value' => variable_get('print_pdf_font_size', PRINT_PDF_FONT_SIZE_DEFAULT),
'#size' => 2,
'#maxlength' => 3,
'#description' => t('(TCPDF only) Set the font size to be used for normal text. This is the base value for the scaling applied to other text styles.'),
);
}
else {
$form['settings'] = array(
'#type' => 'markup',
'#value' => '<p>' . t("No PDF generation tool found! Please dowload a supported PHP PDF generation tool. Check this module's INSTALL.txt for more details.") . '</p>',
);
}
$form['#validate']['_print_pdf_settings_validate'] = array();
return system_settings_form($form);
}