How to add a menu tab programmatically to a views page? I have a view page showing fields of an entity. The pages URL set in Views is 

entity/%


Now I would like to add some tabs to this views pages that I can't generate with views it self, but have to do it programmatically. Si I tried:

function MY_MOODULE_menu() {
  $items['entity/%eid/edit'] = array(
    'title' =&gt; 'Edit',
    'page callback'   =&gt; 'MY_MODULE_entity_edit_callback',
    'access callback' =&gt; true,
    'page arguments' =&gt; array('eid'),
    'type' =&gt; MENU_LOCAL_TASK,
    'weight' =&gt; 100,
  );  
  return $items;
}


As a menu of the type is MENU_NORMAL_ITEM with the base path entity/% is created by the mentioned view, I thought this should simply work, but it does not: The tab does not show up. (Of course I cleared all caches). Did I got something wrong?
Path hierarchy is based on string matching; so entity/%eid/edit doesn't come under entity/% (because '%' != '%eid')

There are a couple of other issues, reading between the lines I reckon this is what you're going for:

function MY_MOODULE_menu() {
  $items['entity/%/edit'] = array(
    'title' =&gt; 'Edit',
    'page callback'   =&gt; 'MY_MODULE_entity_edit_callback',
    'access callback' =&gt; true,
    'page arguments' =&gt; array(1),
    'type' =&gt; MENU_LOCAL_TASK,
    'weight' =&gt; 100,
  );  
  return $items;
}

function MY_MODULE_entity_edit_callback($eid) {
  // ...
}