I was checking out the CVS version of Drupal and noticed that when creating a poll, the first field on the form is labeled "Title". If our goal is to make Drupal usable, then clearly it should be labeled "Question". This problem occurs for other modules, like Flexinode. The first field is always called "Title" which is rarely appropriate for the Flexinode.
I think Drupal needs the flexibility to change this kind of thing. So I'm proposing a new hook called hook_settings(). I thought about creating a new hook called hook_title_label() but figured a more generic hook named "hook_settings()" would have others uses. For example, you could also use it to replace the hook_node_name().
Attached is patch for the poll module to give an example of this hook in action. I'll also upload a patched node.module that takes advantage of this hook.
Comment | File | Size | Author |
---|---|---|---|
#2 | node_27.patch | 506 bytes | Steve Dondley |
#1 | node_26.patch | 506 bytes | Steve Dondley |
poll_1.patch | 683 bytes | Steve Dondley | |
Comments
Comment #1
Steve Dondley CreditAttribution: Steve Dondley commentedAttached node.patch to see how it might use hook_settings()
Comment #2
Steve Dondley CreditAttribution: Steve Dondley commentedOops, node.module patch was reversed. Here's proper patch for node.module
Comment #3
Steve Dondley CreditAttribution: Steve Dondley commentedI forgot that hook_settings() was already taken. How about hook_module_vars() ?
Comment #4
Steve Dondley CreditAttribution: Steve Dondley commentedI forgot that hook_settings() was already taken. How about naming it hook_module_vars() instead?
Comment #5
javanaut CreditAttribution: javanaut commentedI haven't tried out the patch yet (though it looks straight-forward enough), but I'm very much in favor of allowing modules to override the "Title" label. It's very common in my experience to create a node type that doesn't have a "Title", but instead has a "Subject", "Question", "Name", etc.. When I tell clients that they're stuck with the "Title" thing, they tend to complain and I tend to hard-code logic around it that overrides the label for certain instances. Good feature.
Comment #6
adrian CreditAttribution: adrian commentedThere's some very interesting things discussed at drupalcon regarding this.
We'll be making it all public along with the slides and the videos of the discussion pretty damn soon
Comment #7
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedSee http://drupal.org/node/10056