How to theme the title field of the edit form... according to nodetype???
Rosamunda - October 1, 2009 - 03:13
Hi there!
I have this nodetype called invitation, and wanted to theme the title field in the edit form.
Using firebug this is what I´ve got:
<input type="text" class="form-text" value="Septiembre 2009" size="60" id="edit-title" name="title" maxlength="255"/>The id is edit-title and the class is form-text, so I think that it could work in css just adding:
#edit-title .form-text {...}. But that will change all the titles, and I just want to change the title of an specific content type...
Note: I´ve already have a special tpl for the edit form (that works ok), and added to it unset($form['title']);
Note2: The title is a required field, I know, but as I´ve got some code to fill it automatically, I don´t want it to be shown...
Is there a way to do that?
Thanks for your help!!!
Rosamunda

I´ve tried:
I´ve tried:
unset($form['element']['#title']);unset($form['element']['#default_value']);
With no luck...
Rosamunda
Buenos Aires | Argentina
By the way, I already use
By the way, I already use auto_nodetitle, but for some reason (apparently an incompatibility with other -custom- module) I cannot set the option to hide the title field. I just can set the title to non required and only if the user don´t fill it, nodetitle will fill it.
So I need to hide the title from the theme layer.
But don´t know how...
Rosamunda
Buenos Aires | Argentina
Bump?
Bump?
Rosamunda
Buenos Aires | Argentina
.... bump ....
.... bump ....
Rosamunda
Buenos Aires | Argentina
=-=
can you not hide the field with css?
that´s precisely my problem... ho do I do that?
Nope, that´s my problem, I don´t know how to target that specific title (the title field for a specific nodetype form).
I can do that with cck fields and other stuff, but couldn´t with the title...
Rosamunda
Buenos Aires | Argentina
=-=
off the cuff, I'd probably create a custom node.tpl.php file for the content type and/or an edit-contenttype.tpl.php
I'd then wrap the title is a new div
I"d use display: hidden in my style sheet
Probably best to debug the issue of why the custom module and auto_nodetitle don't work together though. Considering that auto_nodetitle does indeed do what is asked.
I see... but that´s what I´ve
I see... but that´s what I´ve tried...
This is what I´ve got on my template.tpl:
function mythemename_preprocess_nodetype_node_form(&$variables) {$variables['intro_text'] = t('This is the intro text... blah');
$variables['rendered'] = drupal_render($variables['form']);
}
It works ok, but if I try to add:
unset($form['element']['#title']);or
unset($form['element']['#default_value']);or
unset($form['title']['#title']);or
unset($form['title']['#value']);It won´t work... how do I add a css class to it? I´ve tried adding a print... with no luck...
Rosamunda
Buenos Aires | Argentina
It seems that the title is a
It seems that the title is a whole different thing to manage than cck fields... and in a bad way, because it´s more difficult to theme a specific title from a specific node.
Rosamunda
Buenos Aires | Argentina
* bump *
* bump *
Rosamunda
Buenos Aires | Argentina
* bump *
* bump *
Rosamunda
Buenos Aires | Argentina
=-=
http://drupal.org/node/426482 may help
a specific node can use a specific tpl.php file as well, which would allow you to add a class.
Thanks!!!
Thanks!!!
Rosamunda
Buenos Aires | Argentina