Provide a link to add content from VIEWS
Submitted by sunildhimal on Thu, 03/28/2013 - 15:25I found out a better way to provide "Add content" link at the footer region of a VIEW. We can achieve followings:
- Pass any number of arguments.
- User can access link only if he/she has permission.
N.B- use Entity Reference for prepopulating valued from URL
Example:
<?php
global $user;
$view = views_get_current_view();
$args = $view->args[0];
if (user_access('create test_report content', $user)) {
$output=l(t('Add new Biochemistry Test '), 'node/add/test-report', array(
'query' => array(
'field_tr_patient_ref' =>$args,