Is there a way I can create a tab to download the mapped pdf?

leon85321 - March 17, 2009 - 22:06
Project:Fill PDF
Version:6.x-1.1
Component:Documentation
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hello,

I have just get it to work with my site (thanks to prior support of the uploading)
Now I know that I can download and view the PDF by using the URL format: mydomain.com/events/fillpdf?fid=[fid]&nid=[nid]
However I would also like to know if there is a way to add this link to a tab attached to the node so it looks like the Edit tab for a node?
Maybe views can help with this?

Thank you,

Leon

#1

lefnire - March 17, 2009 - 23:40

Not views. Add a small custom module and write a hook_menu() function. For some reason I can't get it to work, but I'll come back to it this weekend:

function YOURMODULE_menu(){
  $items=array();
  $items['node/%/pdf'] = array(
    'title' => 'Download PDF',
    'page callback' => 'drupal_goto',
    'page arguments' => array('fillpdf?nid='.arg(2).'&fid='.<<YOUR_FID>>),
    'type' => MENU_LOCAL_TASK,
    'weight' => 100,
  );
  return $items;
}

#2

leon85321 - March 24, 2009 - 20:58

Hello lefnire,

Thanks for your reply, it sounds good to me.
I am new to Drupal and have very limited understanding to PHP and drupal functions.
Please guide me how to implement the code.

Thank you,

Leon

 
 

Drupal is a registered trademark of Dries Buytaert.