Commit 23cc13e2 authored by jcnventura's avatar jcnventura

Fix #321128 by AndyF: add option to display PF links in teaser mode

parent 49328653
......@@ -199,6 +199,13 @@ function print_html_settings() {
'#description' => t('Choose the location of the link(s) to the printer-friendly page. 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 print version of a node by going to !path/nid where nid is the numeric id of the node.', array('!path' => PRINT_PATH)),
);
$form['settings']['print_html_link_teaser'] = array(
'#type' => 'checkbox',
'#title' => t('Display printer-friendly link in teaser'),
'#default_value' => variable_get('print_html_link_teaser', PRINT_HTML_LINK_TEASER_DEFAULT),
'#description' => t('Enabling this will display the link in teaser mode.'),
);
$form['settings']['adv_link'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced link options'),
......
......@@ -42,6 +42,7 @@ function print_uninstall() {
variable_del('print_sourceurl_forcenode');
variable_del('print_html_show_link');
variable_del('print_html_link_pos');
variable_del('print_html_link_teaser');
variable_del('print_html_node_link_visibility');
variable_del('print_html_node_link_pages');
variable_del('print_html_link_class');
......
......@@ -52,6 +52,7 @@ define('PRINT_COMMENTS_DEFAULT', 0);
define('PRINT_NEWWINDOW_DEFAULT', 1);
define('PRINT_HTML_LINK_POS_DEFAULT', 'link');
define('PRINT_HTML_LINK_TEASER_DEFAULT', 0);
define('PRINT_HTML_SHOW_LINK_DEFAULT', 1);
define('PRINT_HTML_NODE_LINK_VISIBILITY_DEFAULT', 0);
define('PRINT_HTML_NODE_LINK_PAGES_DEFAULT', '');
......@@ -749,8 +750,9 @@ function _print_page_match($visibility, $path, $pages) {
* PRINT_ALLOW_BOOK_LINK if a link is allowed in a book node
*/
function print_link_allowed($args) {
if (!empty($args['teaser']) || !user_access('access print')) {
// If showing only the teaser or the user is not allowed or link is disabled
if ((!empty($args['teaser']) && !variable_get('print_html_link_teaser', PRINT_HTML_LINK_TEASER_DEFAULT))
|| !user_access('access print')) {
// If the teaser link is disabled or the user is not allowed
return FALSE;
}
if (!empty($args['path'])) {
......
......@@ -30,6 +30,13 @@ function print_mail_settings() {
'#description' => t('Choose the location of the link(s) to the send by e-mail page. 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 send a node by e-mail by going to !path/nid where nid is the numeric id of the node.', array('!path' => PRINTMAIL_PATH)),
);
$form['settings']['print_mail_link_teaser'] = array(
'#type' => 'checkbox',
'#title' => t('Display send by e-mail link in teaser'),
'#default_value' => variable_get('print_mail_link_teaser', PRINT_MAIL_LINK_TEASER_DEFAULT),
'#description' => t('Enabling this will display the link in teaser mode.'),
);
$form['settings']['adv_link'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced link options'),
......
......@@ -24,6 +24,7 @@ function print_mail_uninstall() {
variable_del('print_mail_settings');
variable_del('print_mail_show_link');
variable_del('print_mail_link_pos');
variable_del('print_mail_link_teaser');
variable_del('print_mail_node_link_visibility');
variable_del('print_mail_node_link_pages');
variable_del('print_mail_link_class');
......
......@@ -13,6 +13,7 @@ define('PRINTMAIL_PATH', 'printmail');
define('PRINT_MAIL_FORMAT', 'mail');
define('PRINT_MAIL_LINK_POS_DEFAULT', 'link');
define('PRINT_MAIL_LINK_TEASER_DEFAULT', 0);
define('PRINT_MAIL_SHOW_LINK_DEFAULT', 1);
define('PRINT_MAIL_NODE_LINK_VISIBILITY_DEFAULT', 0);
define('PRINT_MAIL_NODE_LINK_PAGES_DEFAULT', '');
......@@ -467,8 +468,9 @@ function print_mail_insert_link($path = NULL, $node = NULL) {
* PRINT_ALLOW_BOOK_LINK if a link is allowed in a book node
*/
function print_mail_link_allowed($args) {
if (!empty($args['teaser']) || !user_access('access send to friend')) {
// If showing only the teaser or the user is not allowed or link is disabled
if ((!empty($args['teaser']) && !variable_get('print_mail_link_teaser', PRINT_MAIL_LINK_TEASER_DEFAULT))
|| !user_access('access send to friend')) {
// If the teaser link is disabled or the user is not allowed
return FALSE;
}
if (!empty($args['path'])) {
......
......@@ -42,6 +42,13 @@ function print_pdf_settings() {
'#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']['print_pdf_link_teaser'] = array(
'#type' => 'checkbox',
'#title' => t('Display link to the PDF version in teaser'),
'#default_value' => variable_get('print_pdf_link_teaser', PRINT_PDF_LINK_TEASER_DEFAULT),
'#description' => t('Enabling this will display the link in teaser mode.'),
);
$form['settings']['adv_link'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced link options'),
......
......@@ -24,6 +24,7 @@ function print_pdf_uninstall() {
variable_del('print_pdf_settings');
variable_del('print_pdf_show_link');
variable_del('print_pdf_link_pos');
variable_del('print_pdf_link_teaser');
variable_del('print_pdf_node_link_visibility');
variable_del('print_pdf_node_link_pages');
variable_del('print_pdf_link_class');
......
......@@ -15,6 +15,7 @@ define('PRINT_PDF_FORMAT', 'pdf');
define('PRINT_PDF_LIB_PATH', 'sites/all/libraries');
define('PRINT_PDF_LINK_POS_DEFAULT', 'link');
define('PRINT_PDF_LINK_TEASER_DEFAULT', 0);
define('PRINT_PDF_SHOW_LINK_DEFAULT', 1);
define('PRINT_PDF_NODE_LINK_VISIBILITY_DEFAULT', 0);
define('PRINT_PDF_NODE_LINK_PAGES_DEFAULT', '');
......@@ -481,8 +482,9 @@ function print_pdf_insert_link($path = NULL, $node = NULL) {
*/
function print_pdf_link_allowed($args) {
$print_pdf_pdf_tool = variable_get('print_pdf_pdf_tool', PRINT_PDF_PDF_TOOL_DEFAULT);
if (!empty($args['teaser']) || !user_access('access PDF version') || (empty($print_pdf_pdf_tool))) {
// If showing only the teaser or the user is not allowed or link is disabled
if ((!empty($args['teaser']) && !variable_get('print_pdf_link_teaser', PRINT_PDF_LINK_TEASER_DEFAULT))
|| !user_access('access PDF version') || (empty($print_pdf_pdf_tool))) {
// If the teaser link is disabled or the user is not allowed
return FALSE;
}
if (!empty($args['path'])) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment