views:

115

answers:

2

I have a drupal view, which displays a content type filtered by a url argmuent (e.g. category). Now i'd like to add a link in top of my view, which allows my users to add a new node. In the add form the argument field should be prepopulated with the value from the filter.

I think to archive this, i have to install the prepopulate module and add some php-code to the header section of my view, which generates the link.

Any suggestions how to manage this?

A: 

It would be a lot easier to override the template for the view and insert the code/markup there. Check out the Theming infomation inside the view to find out what to call your template.

googletorp
+1  A: 

If you are wanting to add php code to get the arguments passed to views in the views header section, do the following:

  1. Make sure that the PHP filter is turned on; this is a module that can be enabled
  2. In the header section use the following code:

$view = views_get_current_view();
// [0] is first arg, [1] is second etc.
$argumentOutput = $view-> args[0];

Remember to have the input format set to PHP code. This will get you the argument passed to views.

bkildow