Skip to content
Snippets Groups Projects
Commit fd8fa980 authored by João Ventura's avatar João Ventura
Browse files

When there's no alias defined, link to print*/nid and not print*/node/nid (part 2).

parent 6e16b6c5
No related branches found
No related tags found
No related merge requests found
...@@ -323,7 +323,7 @@ function print_node_view_alter(&$build) { ...@@ -323,7 +323,7 @@ function print_node_view_alter(&$build) {
break; break;
case 2: case 2:
$print_html_link_use_alias = variable_get('print_html_link_use_alias', PRINT_HTML_LINK_USE_ALIAS_DEFAULT); $print_html_link_use_alias = variable_get('print_html_link_use_alias', PRINT_HTML_LINK_USE_ALIAS_DEFAULT);
$path = ($print_html_link_use_alias) ? drupal_get_path_alias('node/' . $build['#node']->nid) : $build['#node']->nid; $path = ($print_html_link_use_alias && ($alias = drupal_lookup_path('alias', 'node/' . $build['#node']->nid))) ? $alias : $build['#node']->nid;
break; break;
} }
...@@ -722,8 +722,8 @@ function print_insert_link($path = NULL, $node = NULL) { ...@@ -722,8 +722,8 @@ function print_insert_link($path = NULL, $node = NULL) {
$path = 'book/export/html/' . $nid; $path = 'book/export/html/' . $nid;
} }
else { else {
if (variable_get('print_html_link_use_alias', PRINT_HTML_LINK_USE_ALIAS_DEFAULT)) { if (variable_get('print_html_link_use_alias', PRINT_HTML_LINK_USE_ALIAS_DEFAULT) && ($alias = drupal_lookup_path('alias', $path))) {
$path = drupal_get_path_alias($path); $path = $alias;
} }
else { else {
$path = $nid; $path = $nid;
......
...@@ -442,8 +442,8 @@ function print_mail_insert_link($path = NULL, $node = NULL) { ...@@ -442,8 +442,8 @@ function print_mail_insert_link($path = NULL, $node = NULL) {
$path = 'book/export/html/' . $nid; $path = 'book/export/html/' . $nid;
} }
else { else {
if (variable_get('print_mail_link_use_alias', PRINT_MAIL_LINK_USE_ALIAS_DEFAULT)) { if (variable_get('print_mail_link_use_alias', PRINT_MAIL_LINK_USE_ALIAS_DEFAULT) && ($alias = drupal_lookup_path('alias', $path))) {
$path = drupal_get_path_alias($path); $path = $alias;
} }
else { else {
$path = $nid; $path = $nid;
......
...@@ -522,8 +522,8 @@ function print_pdf_insert_link($path = NULL, $node = NULL) { ...@@ -522,8 +522,8 @@ function print_pdf_insert_link($path = NULL, $node = NULL) {
$path = 'book/export/html/' . $nid; $path = 'book/export/html/' . $nid;
} }
else { else {
if (variable_get('print_pdf_link_use_alias', PRINT_PDF_LINK_USE_ALIAS_DEFAULT)) { if (variable_get('print_pdf_link_use_alias', PRINT_PDF_LINK_USE_ALIAS_DEFAULT) && ($alias = drupal_lookup_path('alias', $path))) {
$path = drupal_get_path_alias($path); $path = $alias;
} }
else { else {
$path = $nid; $path = $nid;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment