更改表单的 CCK 标题

2021-12-29 00:00:00 preprocessor php drupal cck form-alter

默认情况下,CCK 表单创建具有表单的标题

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

 Create [Your Content Type Name Here]

我想把我的改成

 Register for Such and Such

有人建议我可以使用字符串覆盖,但我找不到要替换的字符串.我也尝试过为 form_alter 编写代码,但似乎无法弄清楚如何更改标题".

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.

想法?

推荐答案

有两种可能,一种是使用主题布局,另一种是设置页面模板中使用的$title变量.您可以使用如 lazy 建议的预处理函数来完成此操作.

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.

我更喜欢的其他选项是使用 drupal_set_title(),这需要放在一个模块中.我没有试过这个,但我认为你可以在你的 hook_form_alter() 实现中使用它.这样您就可以轻松控制更改哪些标题.

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.

相关文章