- 🇫🇷France anrikun
Actually this patch has many problems and should not have been committed.
I suggest we revert it.
🐛 Broken links + Notice : Undefined offset: 1 in theme_print_url_list(). Revert commit #2897361 Needs review
The Source URL and Links inside the exported PDF needs to be rendered as Hyperlinks to be correctly usefull, verifying the code print.pages.inc was found that this was returning the tag P not an hyperlink: "<p><strong>" . t('Links') . "</strong><br />$url_list</p>";
The main problem is if we try to generate a pdf and the path is too long the line will break and the path will be cutted invalidating the same. Another point found is that for the adobe and other tools that render pdf files if the path isn't a hyperlink this will not be clickable, i have attached the code with some modification into the print.pages.inc file, if you guys could please review it i will appreciatte,
/**
* Returns HTML for the source URL line of the print template.
*
* @param array $vars
* An associative array containing:
* - $url: the URL to the full node view.
* - $node: the node object.
* - $cid; comment ID of the comment to display.
*
* @return string
* HTML text with the footer
*
* @ingroup themeable
* @ingroup print_themeable
*/
function theme_print_sourceurl($vars) {
$sourceurl_date = variable_get('print_sourceurl_date', PRINT_SOURCEURL_DATE_DEFAULT);
$url = is_int($vars['cid']) ? $vars['url'] . '#comment-' . $vars['cid'] : $vars['url'];
$output = '<strong>' . t('Source URL');
if ($sourceurl_date && isset($vars['node'])) {
$output .= ' (';
$date = format_date($vars['node']->changed, 'short');
$output .= empty($vars['node']->nid) ? t('retrieved on !date', array('!date' => $date)) : t('modified on !date', array('!date' => $date));
$output .= ')';
}
$new_url = explode("base_url", $url);
$output .= ':</strong>' ."<a href=".$new_url[1].">". $url . '</a>';
return $output;
}
/**
* Returns HTML for the URL list of the print template.
*
* @param array $vars
* An empty associative array
*
* @return string
* HTML text with the URL list
*
* @ingroup themeable
* @ingroup print_themeable
*/
function theme_print_url_list($vars) {
global $_print_urls;
// Display the collected links at the bottom of the page. Code once taken from Kjartan Mannes' project.module
if (!empty($_print_urls)) {
$urls = _print_friendly_urls();
$max = count($urls);
$url_list = '';
foreach ($urls as $key => $url) {
drupal_alter('print_url_list', $url);
$new_url = explode("base_url", $url);
$url_list .= "<a href=".$new_url[1]." target='_blank'>". '[' . ($key + 1) . '] ' . check_plain($url) . "</a>\n";
}
if (!empty($url_list)) {
return "<p><strong>" . t('Links') . "</strong><br />$url_list</p>";
}
else {
return '';
}
}
}
Thanks,
Vitor.
Fixed
2.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Actually this patch has many problems and should not have been committed.
I suggest we revert it.
🐛
Broken links + Notice : Undefined offset: 1 in theme_print_url_list(). Revert commit #2897361
Needs review