Menu callback error : Undefined offset: 4 in _menu_translate() I have created a menu item with form. Everything is working fine, but I am getting the following error message on the menu page.


  Notice: Undefined offset: 4 in _menu_translate() (line 777 of /home/sysop/old-server/heisenberg/includes/menu.inc).




The code I am using is the following.

/* 
 *implements hook_menu 
 */
function planet_extension_menu() {
 $items['admin/structure/feeds_admin'] = array(
'title' =&gt; 'Planet Extension',
'page callback' =&gt; 'main_table',
'access arguments' =&gt; array('access administration pages'),
'file' =&gt; 'planet_extension.admin.inc',
'type' =&gt; MENU_CALLBACK,
);

    $items['admin/structure/feeds_admin/manage/%/delete'] = array(
    'title' =&gt; 'Delete',
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('delete_feed',4),
    'access arguments' =&gt; array('access administration pages'),
    'type' =&gt; MENU_LOCAL_TASK,
    'file' =&gt; 'planet_extension.admin.inc',
    );

    $items['admin/structure/feeds_admin/manage/%/submit'] = array(
    'title' =&gt; 'Approve',
    'page callback' =&gt; 'submit_feed',
    'page arguments' =&gt; array(4),
    'access arguments' =&gt; array('access administration pages'),
    'type' =&gt; MENU_LOCAL_TASK,
    'file' =&gt; 'planet_extension.admin.inc',
    );
    return $items;
}


file : planet_extension.admin.inc

/**
 * Function main_table().
 */ 

function main_table() {

  $header = array(

    array('data' =&gt; t('ID'), 'field' =&gt; 'id', 'sort' =&gt; 'asc'),

    array('data' =&gt; t('Title of Feed'), 'field' =&gt; 'title'),

    array('data' =&gt; t('Feed URL'), 'field' =&gt; 'url'),    

    array('data' =&gt; t('TYPE'), 'field' =&gt; 'category'),

    array('data' =&gt; t('Submitted By'), 'field' =&gt; 'email'),

    array('data' =&gt; t('Operations'), 'colspan' =&gt; 2),

  );



  $query = db_select('planet_extension', 'p');

  $query-&gt;fields('p', array('id','title','url','category','email'));



  $table_sort = $query-&gt;extend('TableSort') // Add table sort extender.

                      -&gt;orderByHeader($header); // Add order by headers.

  $pager = $table_sort-&gt;extend('PagerDefault')

                      -&gt;limit(20);

  $result = $pager-&gt;execute();

  $rows = array();

  foreach($result as $res){

    $rows[] = array($res-&gt;id, $res-&gt; title, $res-&gt;url, $res-&gt;category, $res-&gt;email,(l(t('Approve'), 'admin/structure/feeds_admin/manage/' . $res-&gt;id . '/submit')),(l(t('Decline'), 'admin/structure/feeds_admin/manage/' . $res-&gt;id . '/delete')));
}
  // If rows are not empty theme and display the rows.

  $output = '';

  if (!empty($rows)) {

    $output = theme('table', array('header' =&gt; $header, 'rows' =&gt; $rows, 'attributes' =&gt; array('id' =&gt; 'sort-table')));

    $output .= theme('pager');

  }

  else {

    $output .= t("No results found.");

  }

  return $output;

}

/*
 *Delete function
 */
function delete_feed($form,&amp;$form_state,$variable) {
      $form['feed_id'] = array( 
      '#type' =&gt; 'value',
      '#value' =&gt; $variable,
      );
    return confirm_form($form, t('Are you sure you want to delete this feed %variable ?', 
    array('%variable' =&gt; $variable)), '/admin/structure/feeds_admin', 'Warning!! Would you like to continue with delete?', t('Delete'));
  }

/**
 * Delete given field
 */
function delete_feed_submit($form,&amp;$form_state) {
    $id = $form_state['values']['feed_id'];
    $num_deleted = db_delete('planet_extension')
      -&gt;condition('id', $id)
      -&gt;execute();
    drupal_set_message(t('Feed %id successfully removed.', array('%id' =&gt; $id)));
    drupal_goto('/admin/structure/feeds_admin');
  }

/**
 *submit handler
 */
function submit_feed($variable) {
}
What is the % parameter in the url used for - a feed item maybe?

For that type of UI, you may need to add a load function and use a named parameter instead for the %

e.g:

/** 
 * Implements hook_menu 
 */
function planet_extension_menu() {
 // ...
 // ...
    $items['admin/structure/feeds_admin/manage/%pe_feed_item/delete'] = array(
    'title' =&gt; 'Delete',
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('delete_feed',4),
    'access arguments' =&gt; array('access administration pages'),
    'type' =&gt; MENU_LOCAL_TASK,
    'file' =&gt; 'planet_extension.admin.inc',
    );
 // ...
 // ...
}

/** 
 * Menu callback load function for pe_feed_item argument
 * This function loads the feed item 
 * which is then passed as a page argument to the menu callback function
 */
function pe_feed_item_load($fid) {
  // Load feed item somehow from feed id and return it, e.g:
  return db_query("SELECT * FROM {pe_feed_item} WHERE fid = :fid", array(':fid' =&gt; $fid))-&gt;fetchObject();
}