0
 $items['jobs/%'] = array(
    'page callback' => 'custom_changes_jobs_interface_create_update',
    'access callback' => TRUE,
    'page arguments' => array(1),
  );

I need to use jobs for POST request and jobs/% for put and delete request where the argument would be string but if its not passed I want to make sure it works.

2

You have two options:

1) Define both paths, jobs and jobs/%.

2) Define only the first path

$menu['jobs'] = array(
  'page callback' => 'my_page_callback',
  ...

Then make the argument optional:

function my_page_callback($job_id = FALSE) {
  ...   

This callback will be called for both paths.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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