Strange custom page title behaviour

Created on 14 January 2016, about 9 years ago
Updated 21 October 2024, 6 months ago

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.

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.

🐛 Bug report
Status

Closed: outdated

Component

Code

Created by

🇨🇦Canada Dave Bagler

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇫🇷France dqd London | N.Y.C | Paris | Hamburg | Berlin

    Drupal 7 EOL is January 2025 and this issue has no activity.

Production build 0.71.5 2024