using hook_menu_alter to alter a page callback

Hey there,

So I am using D7 and the entityforms module. By default, entityform submissions can be viewed via the URL entityform/. I have a path alias setup to point to /a/different/url/ to view the submission.

I need to add some form functionality to this page, so I wrote a module to remake this page completely in code, pulling in the values of the submission via entity_load_single(). I have the page working, however I am now trying to alter the menu so that the default menu tabs (View/Edit/Delete) that came with the original page now show up on this page and still work as before.

I am essentially replacing the default entityform view page with my own, which has a form on it. In doing so, I lost the ability to get to the View/Edit/Delete menu tabs, and am looking to re-add it to this new page.

My hook_menu() implementation looks like this:

$items['a/different/url/%'] = array(
    'title'           => t('View'),
    'type'            => MENU_DEFAULT_LOCAL_TASK,
    'page callback'   => 'drupal_get_form',
    'page arguments'  => array('new_book_request_view_form',3),
    'access callback' => TRUE,
  );

I am using hook_menu_alter like this:

function mdelio_book_request_update_menu_alter(&$items) {
  $items['entityform/%']['page callback'] = 'drupal_get_form';
  $items['entityform/%']['page arguments'] = array('new_book_request_view_form',1);
}

However I don’t think that’s correct. Could somebody point me in the right direction so that I can retain the default menu tabs, but so that the ‘View’ tab points to my new page, not the default one?

I appreciate it.

Drupal version: 


Source: https://www.drupal.org/taxonomy/term/4/feed