function print_mail_form in Printer, email and PDF versions 7.2
Same name and namespace in other branches
- 5.4 print_mail/print_mail.inc \print_mail_form()
- 5.3 print_mail/print_mail.inc \print_mail_form()
- 6 print_mail/print_mail.inc \print_mail_form()
- 7 print_mail/print_mail.inc \print_mail_form()
- 5.x print_mail/print_mail.inc \print_mail_form()
Form constructor for the send by email form.
2 string references to 'print_mail_form'
- print_mail_menu in print_mail/
print_mail.module - Implements hook_menu().
- print_mail_mollom_form_info in print_mail/
print_mail.module - Implemenents hook_mollom_form_info().
File
- print_mail/
print_mail.inc, line 21 - Displays and processes the mail send form.
Code
function print_mail_form($form, &$form_state) {
// Remove the printmail/ prefix.
$path_arr = explode('/', $_GET['q']);
unset($path_arr[0]);
$path = filter_xss(implode('/', $path_arr));
if (empty($path)) {
// If no path was provided, let's try to generate a page for the referer.
global $base_url;
$link = print_mail_print_link();
$ref = $_SERVER['HTTP_REFERER'];
$path = preg_replace("!^{$base_url}/!", '', $ref);
if ($path === $ref || empty($path)) {
$path = variable_get('site_frontpage', 'node');
}
drupal_goto($link['path'] . '/' . $path);
}
elseif (ctype_digit($path_arr[1])) {
if (drupal_lookup_path('source', $path)) {
// This is a numeric alias.
$path = drupal_get_normal_path($path);
}
else {
// Normal nid.
$path = 'node/' . $path;
}
}
else {
$path = drupal_get_normal_path($path);
}
// Handle the query.
$query = $_GET;
unset($query['q']);
return print_mail_form_for_path($form, $form_state, $path, $query);
}