Hi,

I have a view that shows up as a tab on a particular node type showing "assessments"..
Path of the node is standard..
Path of the view is node/%node/assessments

I am trying to create a local task link to create a new assessment referencing the main node..

This is what I have so far..

function assessments_menu_alter(&$items) {
    $items['node/%node/assessments/add']['access callback'] = 'user_create_access';
    $items['node/%node/assessments/add'] = $items['node/add/assessment'];
    $items['node/%node/assessments/add']['title'] = 'add Assessment';
    $items['node/%node/assessments/add']['type'] = MENU_LOCAL_ACTION;
}

This works but obviously isn't complete to have the node reference already selected..

I have tried everything I can think of but keep getting an "Undefined Index" error..

Even hard coding the path to 'node/add/assessment/1' gives me the error..

Anyone have any pointers on how I can a) get the path dynamically built and b) not give me errors..

Thanks..

Comments

quicksketch’s picture

I generally don't help with custom coding requests in the issue queue, but have you read the README.txt file? The section on "Advanced: Support for non-standard URLs" should help you accomplish what you want from the node-reference URL side of things. At least then you should be able to visit "node/1/assessments/add" and it will populate node reference field properly.

wipeout_dude’s picture

Thanks for replying..

I did see that in the advanced section of the README.txt but since the local action is redirecting to /node/add/assessment I thought it would need to construct the URL the same the link created on the content type of /node/add/assessmnet/[nid]..

I'll give it a try..

Thanks anyway..