Skip to main content
edited title
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

hook_menu dynamic Dynamic parameters passpassed to page callback

edited tags
Link
Yuseferi
  • 22.2k
  • 22
  • 118
  • 218
Source Link
Alex.Barylski
  • 859
  • 2
  • 13
  • 27

hook_menu dynamic parameters pass to page callback

I have the following hook_menu:

  $items['products/autocomplete.json/%'] = array(
    'page callback' => 'json_list_products',
    'access arguments' => array('access products')
  );

Here is the function:

function json_list_products($keywords) {
  
  $items = array();
  foreach(_sql_select_products($keywords) as $product) {
    $items[$product['Product_ID']] = $product['Product_Name'];
  }    
  
  drupal_json_output($items);
}

$keywords is not populated with the value of the % as i suspected - how do I populate this value?

Alex