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.

CommentFileSizeAuthor
#2 node_27.patch506 bytesSteve Dondley
#1 node_26.patch506 bytesSteve Dondley
poll_1.patch683 bytesSteve Dondley
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Steve Dondley’s picture

FileSize
506 bytes

Attached node.patch to see how it might use hook_settings()

Steve Dondley’s picture

FileSize
506 bytes

Oops, node.module patch was reversed. Here's proper patch for node.module

Steve Dondley’s picture

I forgot that hook_settings() was already taken. How about hook_module_vars() ?

Steve Dondley’s picture

I forgot that hook_settings() was already taken. How about naming it hook_module_vars() instead?

javanaut’s picture

I 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.

adrian’s picture

There'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

killes@www.drop.org’s picture