3

By default a CCK form creation has a title of the form

 Create [Your Content Type Name Here]

I want to change mine to

 Register for Such and Such

It was suggested that I could use string-override, but I can't find the string to replace. I've also tried writing code to form_alter, but can't seem to figure out how to get the "title" to change.

Ideas?

googletorp
  • 33,075
  • 15
  • 67
  • 82
cgp
  • 41,026
  • 12
  • 101
  • 131

2 Answers2

2

There are two possibilities, either you can use the theming laying and set $title variable used in the page templage. You can do this with a preprocess function like lazy suggests.

The other options which I prefer would be to use the drupal_set_title(), this would need to go in a module. I haven't tried this, but I would think that you could use this in your hook_form_alter() implementation. That way you could control which titles get changed pretty easily.

googletorp
  • 33,075
  • 15
  • 67
  • 82
  • I tried this out and it worked great. Thank you! Much head banging for me over this. Should I be using drupal_set_title(t('something')) so that I can use localization later? – cgp Sep 01 '09 at 10:57
  • Yeah, it's always a good idea to use the t function. Remember to use placeholders for the variables (the content type). – googletorp Sep 01 '09 at 11:03
1

Hook form_alter doesn't affect the title, but you can use a preprocess function:

Try this code to start:

function MYMODULENAME_preprocess(&$variables) {
  $variables['title'] = 'test title';
}
lazysoundsystem
  • 2,039
  • 23
  • 23
  • Thank you! I'm not sure which is the "more" correct answer, they both seem good. – cgp Sep 01 '09 at 10:54