This is a bug I noticed in the Admin Menu when using the Entity API to create an Entity that uses the EntityDefaultUIController::hook_menu function (like the Profile2 module). The "Add @entity_type" and "Import @entity_type" menu link's are blank after clearing the menu cache. If you clear all caches then the link titles will re-appear.

Steps to reproduce:
1. have admin menu installed
2. create an entity that uses the EntityDefaultUIController's hook_menu function (or install Profile2 as an example)
3. clear menu cache
4. go to Structure -> [Entity Type] and notice the sub menu's don't have titles

Comments

cdale’s picture

Version: 7.x-1.0-rc1 » 7.x-1.x-dev

I just encountered this as well. Moving the function entity_ui_get_action_title() out of includes/entity.ui.inc and into entity.module resolved the problem for me. I think at the time the title's are processed, the entity.ui.inc file is not yet loaded, so no title callback is available, hence, no titles.

cdale’s picture

As an aside, the add and import items don't really need a title callback, as they are fixed strings. When I override the UI Controller class, it's something I generally change in the hook_menu() function, so this could also be an alternative solution to moving the function.

cdale’s picture

Sample code I normally have in hook_menu when extending EntityDefaultUIController.


    $items[$this->path . '/add']['title'] = entity_ui_get_action_title('add', $this->entityType);
    unset($items[$this->path . '/add']['title callback']);
    unset($items[$this->path . '/add']['title arguments']);
    if (!empty($this->entityInfo['exportable'])) {
      $items[$this->path . '/import']['title'] = entity_ui_get_action_title('import', $this->entityType);
      unset($items[$this->path . '/import']['title callback']);
      unset($items[$this->path . '/import']['title arguments']);
    }

codycraven’s picture

Status: Active » Needs review
StatusFileSize
new1.65 KB

Moved entity_ui_get_action_title() into .module so that menu title callback function is available on non-entity UI pages when menu cache flushes.

peximo’s picture

Status: Needs review » Needs work

The last submitted patch, entity-fix-blank-menu-titles-1398314-4.patch, failed testing.

peximo’s picture

Status: Needs work » Needs review
StatusFileSize
new2.94 KB

Rerolled.

plach’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

This is working here.

fago’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.