[英]Drupal Print Module - change name for PDF output
How to change name for PDF output in PRINT module, for each module separately? 如何在PRINT模块中为每个模块单独更改PDF输出的名称? Can I use a some sort of hook for it? 我可以使用某种钩子吗? Any help? 有帮助吗?
The Print module includes a drupal_alter function in print_pdf.page.inc Print模块在print_pdf.page.inc中包含drupal_alter函数
drupal_alter('print_pdf_filename', $pdf_filename, $path);
This results in the following hook being available for use: 这导致以下钩子可供使用:
function hook_print_pdf_filename_alter(&$pdf_filename, $path) {
$pdf_filename = 'yourfilename';
}
I could not find a hook but I did manage to find the variable for it. 我找不到一个钩子,但我确实找到了它的变量。
I had a look at the module and it seems it is setting the name at line 41 page print.pdf.pages.inc. 我看了一下这个模块,似乎是在第41行print.pdf.pages.inc中设置名称。
$pdf_filename = variable_get('print_pdf_filename',
PRINT_PDF_FILENAME_DEFAULT);
So try this and put this code in your module. 所以试试这个并把这个代码放在你的模块中。 I am not sure if it will work 我不确定它是否有用
variable_set('print_pdf_filename', $nameouwant);
cheers, Vishal 维沙尔,欢呼声
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.