Hi,

when I activate a module depending on this API (for example the Checklist API example or the QA Checklist module) I cannot access the path mentioned in .info file (for example admin/config/development/checklistapi-example). It seems that this path is not known to Drupal - just when I rebuild cache or the menu system the path becomes known to Drupal. Additionally when I deactivate such a module the paths keep existing in Drupal's menu system leading to error messages when you click on them.

It is seems toi me that it is quite clear why: the path is defined by checklistapi_menu() which checks for available checklists with checklistapi_get_checklist_info() . As modules depending on this API are not activated before this API module the new checklists are not known to checklistapi_get_checklist_info() at the moment when checklistapi_menu() is called. But unfortunately I do not have a solution right now for that.

Best,
Tobias

Comments

tobiberlin created an issue. See original summary.

tobiberlin’s picture

Strange - I installed the Checklist example module on a production server and the paths were accessible right after installing the module... the issue above appeared on my local installation but I am quite sure that there no differences between them... do I see some ghosts???

TravisCarden’s picture

Thanks, @tobiberlin. This has come up before: #1276596: Menu item not appearing until cache cleared. Since it's a menu caching issue, its manifestation may be unpredictable, as you've experienced. I had previously chalked it up to an unfortunate detail of Drupal's menu handling that's beyond my control, but I suppose there would be ways it could be mitigated. Perhaps, for example, I could inspect the menu cache during checklistapi_get_checklist_info() and selectively clear it for missing paths. I'm not sure when I'll have time to investigate. In the meantime, patches welcome. :)

TravisCarden’s picture

Status: Active » Closed (won't fix)

I've thought about ways to address this, but I haven't come up with any that don't have unacceptable performance side effects. I'm happy to consider suggestions if anyone has them, but in lieu of that I'm considering this a limitation of core's menu system in D7 and marking "won't fix". If you experience the problem, please clear your menu cache to fix it. (drush cc menu) Thanks.

tobiberlin’s picture

Status: Closed (won't fix) » Active

I want to re-open it - I do not think that it is necessary to put the custom checklists directly to the menu system. I think to avoid these problems it would be better to build one overview page where the active checklists are listed. This keeps us from confusing, don't you think?

TravisCarden’s picture

Status: Active » Closed (won't fix)

I can appreciate that argument, @tobiberlin, and perhaps I'll take that approach with the Drupal 8 version before releasing the stable version. But I'm not willing to make an API change that removes a feature that's been a part of the Drupal 7 version for its entire lifetime. Thanks!