Changing CCK Title for Form

陌路散爱 提交于 2019-12-10 21:18:36

问题


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?


回答1:


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.




回答2:


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';
}


来源:https://stackoverflow.com/questions/1360229/changing-cck-title-for-form

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!