Download & Extend

hook_help and theme('help') interfere when module and theme named the same

Project:Drupal core
Version:6.x-dev
Component:base system
Category:bug report
Priority:normal
Assigned:webchick
Status:needs work

Issue Summary

It's also not uncommon to do a website for example.com and name the theme "example" since it's for example.com, and a custom module with site-specific customizations "example" as well. However, doing this causes conflicts. The one we ran into today was with help text, which would spew out:

warning: Missing argument 1 for example_help() in \modules\example.module on line 12.

You can give $section a default value of NULL to get it to stop doing that, but then no help will display anywhere on the site.

This might be a "Well then don't do that!" problem, but it was very confusing trying to track this down so I figured I'd mention this.

Comments

#1

Title:Module + Theme named the same causes conflicts» hook_help and theme('help') interfere when module and theme named the same
Version:4.7.2» x.y.z
Assigned to:Anonymous» webchick
Status:active» needs review

This happened to me again tonight so I looked more into it, and hit a "duh" moment. :P

Of course they can't be named the same; When PHPTemplate encounters a theme('something') call, it first attempts:

current_theme_something()

then
phptemplate_something()

and finally
theme_something()

So when phptemplate.engine is calling theme('help') in a theme called "foo", it's interfering with foo_help in foo.module, which is a help hook.

Attached patch renames theme_help to theme_help_message to stop this from happening.

AttachmentSizeStatusTest resultOperations
help_message.patch2.27 KBIgnored: Check issue status.NoneNone

#2

Status:needs review» postponed

Talked to drumm... since this is an API change, it won't get in the 5.0 release cycle, so changing status to "postponed" so I can re-roll when HEAD opens up again.

#3

Version:x.y.z» 6.x-dev
Status:postponed» needs work

I forgot about this again until just tonight. :) Hopefully can get it in pre-code-freeze this time. ;)

#4

This one caught me too.

I agree it's natural to have a theme and module named the same thing.

#5

I've no idea why this isn't working. I must be missing something silly. Any ideas?

AttachmentSizeStatusTest resultOperations
core-theme_help_message-72645-5.patch2.89 KBIgnored: Check issue status.NoneNone

#6

Is there any interest in this issue?

nobody click here