I have a Drupal node module that combines the standard "node" DB table with additional information in a table that I've titled "persona". The module is named "persona".
I would like to automatically fill in the "Title" field in the Node table, but currently, there's no apparently way for me to automatically override the "Title" field that's created by default when you define the function "persona_form". I'm wondering if the following can be done without changing the actual Drupal core:
- Rename the "Title" label to something else
- Remove entirely the "Title" text field from appearing on the form
- Automatically insert the value "Title" field based on other parameters
Specifically, I want to be able to ensure that the "Title" is standardized among all nodes of type "Persona", and I want to ensure that this somehow reflects in the UI. I don't want users to type in a title, and then have the system automatically overwrite it behind the scenes.
If this can't be done, please let me know so I can submit a feature request for the system.
Thank you!
~~~~~~~
Miscellaneous background information: I have a Drupal node module that I am writing that are used to manage Persona Sheets for a story-based role-playing game. Persona sheets describe a character that each user has to play the game with. There's some information that I required, such as "Character Name", "Character Age", and so forth that didn't fit in well with the existing Node table, so I created a Persona table with a node ID to store the extra information. What I want the title to say is "P-sheet: $character_name" where $character_name is the character name entered by the user.
Comments
This can't be currently done.
However, there is a patch that needs reviewing and might make it into the core. The patch is 0094.steph.titles-in-nodes-modules.patch
and is available from the for_review directory in the contributions cvs.
Please help to test it and send feedback to the devel mailinglist.
--
Drupal services
My Drupal services
Preview not working
I've applied the patch to Drupal 4.2.0 (I'm not bold enough to use CVS, since I'm a module developer customizing something for a web site and I want to stick with the stable version) and so far I've noticed that the Titles do not save in the "Preview". They also are not displayed when you Edit the node.
I think I know what the problem is. In the lines:
* They must change to:
Ideally, I would like to see a function that does all of this for you automatically, called something like:
form_titlefield()
I will make a patch from the CVS.
-- Irwin (Arcana)
Automatic node titles
For 4.7 (since this thread is 3 years old), there is currently a module that automatically sets the node's title to the node's content type name.
(Username formerly my full name, Richard Eriksson.)