[drupal-devel] [feature] Proposal for new hook: hook_settings()
javanaut
drupal-devel at drupal.org
Sat Feb 26 22:02:22 UTC 2005
Project: Drupal
Version: cvs
Component: node system
Category: feature requests
Priority: normal
Assigned to: Anonymous
Reported by: nysus
Updated by: javanaut
Status: patch
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.
javanaut
Previous comments:
------------------------------------------------------------------------
February 26, 2005 - 07:20 : nysus
Attachment: http://drupal.org/files/issues/poll_1.patch (683 bytes)
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.
------------------------------------------------------------------------
February 26, 2005 - 07:41 : nysus
Attachment: http://drupal.org/files/issues/node_26.patch (506 bytes)
Attached node.patch to see how it might use hook_settings()
------------------------------------------------------------------------
February 26, 2005 - 07:44 : nysus
Attachment: http://drupal.org/files/issues/node_27.patch (506 bytes)
Oops, node.module patch was reversed. Here's proper patch for
node.module
------------------------------------------------------------------------
February 26, 2005 - 08:04 : nysus
I forgot that hook_settings() was already taken. How about
hook_module_vars() ?
------------------------------------------------------------------------
February 26, 2005 - 08:05 : nysus
I forgot that hook_settings() was already taken. How about naming it
hook_module_vars() instead?
--
View: http://drupal.org/node/18003
Edit: http://drupal.org/project/comments/add/18003
More information about the drupal-devel
mailing list