I have a drupal website, in which I wanted to add a new URL. This menu have two arguements which should be passed from the client side.
function campaign_management_menu() {
$items = array();
$items['campaign-management/test/%/%'] = array(
'title' => 'Campaign Management',
'description' => 'A section where you can manage your campaigns',
'page callback' => 'cm_home',
'page arguments' => array(3, 4),
'access callback' => TRUE,
);
return $items
}
Here, for the fourth argurment, there should be only two options {add/edit}. Is there any option in drupal to set these two keywords explicitely. ie,
$items['campaign-management/test/%/{add|edit}'] = array(
'title' => 'Campaign Management',
'description' => 'A section where you can manage your campaigns',
'page callback' => 'cm_home',
'page arguments' => array(3, 4),
'access callback' => TRUE,
);
As far as hook_menu documentation says, there is no such feature: http://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_menu/7
You'll have to use wildcard: '%'. But in cm_home function, you can check the 2-nd parameter, whether it is 'add' or 'edit'. So you'll validate the input there.