1

Problem:

When I try to overwrite the title of the edit link of a an entity built with ECK the page responds with an access denied message.

Background:

  • I have an entity built using ECK.
  • I am overwriting it's CRUD paths using hook_entity_info_alter().
  • I am overwriting the add link title in hook_menu_alter() with no issue.
  • I am rebuilding the menu.

This works:

function mymodule_menu_alter(&$items) {
  $items['myentity/add']['title'] = t('Add your Entity');
} 

This causes the edit link to throw an 'access denied' error:

function mymodule_menu_alter(&$item) {
  $items['myentity/add']['title'] = t('Add your Entity'); // Still works.

  $items['myentity/%/edit']['title'] = t('Edit your Entity'); // Access Denied!
}

Has anyone else run into a similar issue and if so do you have a solution or work-around? Thanks.

Update

For fun I went into the database and manually changed the title of the menu items to see what would happen. If I just change the title directly in the database the updated title is displayed and the page works as expected.

  • $items['myentity/%/edit']['title'] = t('Edit your Entity'); – Huelfe Jan 12 '16 at 16:05
  • Is the syntax error a copy/paste mistake or is that literally the code that's being executed? – Clive Jan 12 '16 at 16:07
  • Sorry the syntax error was just a copy/paste mistake. – DaveBagler Jan 12 '16 at 16:16

Your Answer

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

Browse other questions tagged or ask your own question.