I am generating the return value for a hook_menu() with values from a query.

 $items[$record->path_prefix . '/my_path/%'] = array(
     'title' => 'Topic Redirect',
     'page callback' => 'my_callback',
     'page arguments' => array($record->id,2),
     'access callback' => TRUE,
     'type' => MENU_CALLBACK

This will automatically pass the argument that is the record id to the callback function. I would like it to pass the value. Is there an easy way to do this?

1 Answer 1


I normally just wrap the value in quotes, that should convince the router system to leave it alone:

'page arguments' => array("$record->id", 2)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.