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:  

Rosamunda - October 1, 2009 - 17:16

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

Rosamunda - October 1, 2009 - 20:27

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?

Rosamunda - October 3, 2009 - 17:15

Bump?

Rosamunda
Buenos Aires | Argentina

.... bump ....

Rosamunda - October 5, 2009 - 20:36

.... bump ....

Rosamunda
Buenos Aires | Argentina

=-=

VM - October 5, 2009 - 20:42

can you not hide the field with css?

that´s precisely my problem... ho do I do that?

Rosamunda - October 5, 2009 - 22:32

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

=-=

VM - October 5, 2009 - 23:28

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

Rosamunda - October 6, 2009 - 02:18

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

Rosamunda - October 7, 2009 - 19:33

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 *

Rosamunda - October 8, 2009 - 17:20

* bump *

Rosamunda
Buenos Aires | Argentina

* bump *

Rosamunda - October 12, 2009 - 22:07

* bump *

Rosamunda
Buenos Aires | Argentina

=-=

VM - October 12, 2009 - 23:23

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!!!

Rosamunda - October 13, 2009 - 00:53

Thanks!!!

Rosamunda
Buenos Aires | Argentina

 
 

Drupal is a registered trademark of Dries Buytaert.