[drupal-devel] [feature] Proposal for new hook: hook_settings()

adrian drupal-devel at drupal.org
Sun Feb 27 01:57:11 UTC 2005


 Project:      Drupal
 Version:      cvs
 Component:    node system
 Category:     feature requests
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  nysus
 Updated by:   adrian
 Status:       patch

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


adrian



Previous comments:
------------------------------------------------------------------------

February 26, 2005 - 15: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 - 15: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 - 15: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 - 16:04 : nysus

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


------------------------------------------------------------------------

February 26, 2005 - 16:05 : nysus

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


------------------------------------------------------------------------

February 27, 2005 - 00:02 : javanaut

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.


-- 
View: http://drupal.org/node/18003
Edit: http://drupal.org/project/comments/add/18003





More information about the drupal-devel mailing list