Hey all,
I've been searching for days for an approach that actually works - its a shame that this isn't a simple option when editing each node type from the regular drupal admin side but...
...I'm looking for a snippet to throw into my template.php which will let me specify a custom title atop a node submission/editing page per content type; so instead of 'Create Tomato' I could specify say 'Throw a tomato at us' when a user is looking @ the node/add/tomato page.
I'd love to know if there's an approach to use for both drupal 5 and 6 - if they aren't the same then I would super appreciate snippets for both... I'm surprised to not have found this info anywhere in the handbook...
Thanks,
q./
Comments
theme your node form
as per http://drupal.org/node/68999 [hehe, toot-toot!] you can set the title in your form theme.
so in your template.php file, define (or extend), replacing as appropriate:
This will allow you to redefine all node edit form titles actually. You'll have to modify slightly if you don't want to modify the title when you're editing existing nodes.
Thanks to Andre Molnar for setting me on the one and true drupal way for this solution.
relocates buttons
Using this method in Drupal 6, my title is correctly changed by my submit and preview buttons get relocated to the top of my form. I'm not sure why that's happening, but any ideas...
odd thing...
odd thing... exactly the same happened to me.
devilish details
If you check out the node module, you'll see that there's already a theme_node_form. So the above solution replaces that theme, which causes unexpected side-effects (including the relocating of buttons as observed in other comments).
So, to fix the above solution, replace that last
return drupal_render($form)
line with
return theme_node_form($form)
so that the usual fix ups to the form are done (see comments in the node.page.inc file to see all of what theme_node_form does).
Many thanks -- here's a variation for forum topics
I was using this solution for customizing the node create page for a forum topic, and I wanted to include the specific forum topic name (which is a taxonomy term) into the title text. After much struggle, I hit on the trick of using arg() to get the term id (in this case the path is node/add/forum/id, so it was arg(3)) and then calling taxonomy_get_term with it. Here's the result:
Module solution
Hi,
I've written a module to address this
http://www.practicalweb.co.uk/blog/09/05/25/module-make-title-nodeadd-pa...
Sponsored by
http://www.consultanddesign.net/
I've applied for a Drupal CVS account to upload this
Sean Burlington
www.practicalweb.co.uk
Drupal CVS
Any luck with the Drupal CVS account?
for those who stumble across
i'm quite sure this is not the best approach, but it got me quickly back to a working theme after moving from 5.x to 6.x.
for several content types, we have a parent-child relationship (e.g. school assignment/student submission to that assignment). for these types of content, we display the form side by side with its parent. in 5.x we used this in the template.php file:
for 6.x we have moved to this:
i tried getting preprocess functions to work, and they were great for displaying nodes, but i could not figure out how to customize the node/add node/edit using that approach.
here's the code for the node-add-tasksubmit.tpl.php the hairy sql is used to figure out what node to display on the left:
Hi, I'm looking for custom
Hi, I'm looking for custom node/add page titles.
1. Put the code in template.php
2. node-add-tasksubmit.tpl.php
but where i set custom titles for different content types ?
example:
content-type1 = blablabla[title]
content-type2 = [title]blablabla
Another solution
Actually, i'm using this code display in an active block:
This method works very well, but you have to create one block per node type...
@Junro How can I hide the
@Junro How can I hide the original title displayed by default?
Hello, Now, what the best
Hello,
Now, what the best approach for D6?
Thanks
https://interface-network.com - Interface Network is an action and research technology governance agency.
Hello, I try this code in my
Hello, I try this code in my template.php file but it doesn't work
I had only replace 'my_node_type'
Is this code still working in D6?
It doesn't work in mine either
Not sure why, I gave this in my template.php abd it doesn't work either.
re
it’s good to see this information in your post, i was looking the same but there was not any proper resource.
assignment | lab report writing help
Custom module
here is a snippet of how to achieve that in you custom module
Drupal in the Amazon Jungle
Title not changed when validate
Hi,
drupal_set_title('My new title') is working fine when the form loads.
But when form submits and if there are any validation errors, the title is reverted back instead of "My new title".
Please help.
--thanks
Here's my roundabout way of
Here's my roundabout way of dealing with that. I added an additional validation handler that sets the page title to the same thing as in my form_alter. Not pretty, but it works:
Thanks for that... Couldn't
Thanks for that... Couldn't work out why the title changed after my validation kicked in...
I am always interested in paid work... Contact me through Online Business Builders
Perhaps a better way
I think a better way to do this is with the use of an after_build callback
In your form alter you can specify this as
$form['#after_build'][] = 'node_entry_form_after_build';
Then define a callback function of the same name
customizing node's add form
http://drupal.org/node/729322
There is module for that
I had the need for a module like this. After checking this post and others I rolled out the module Node Add Title for Drupal 7. Hope it can help you.
Node Add Title will let you change the title of the node creation pages and the node editing pages.
The contributed Node Add
The contributed Node Add Title module helped me in this type of similar case. Also there are other ways mentioned on Stack exchange which might be helpful http://stackoverflow.com/questions/1392573/changing-the-node-creation-ti....
Module for other forms
I've built a simple module to control any page with a drupal form behind it — Form page title.
For now, it's experimental, but if someone will be interested, I'll promote it.
With best regards,
Ruslan Isay
i'm quite sure this is not
i'm quite sure this is not the best approach, but it got me quickly back to a working theme after moving from 5.x to 6.x.