Drupal:如何更改“标题”创建新节点时的标签?

发布于 2024-08-04 14:02:55 字数 473 浏览 4 评论 0原文

如何使用 Drupal 5 创建特定事件时更改“标题”标签。 我正在使用 事件模块 。我需要破解 Drupal 的核心代码吗?

我当前的 URL 添加事件节点是:

http://cec5/bhutan/?q=en/node/add/event

截图: alt text http://i29.tinypic.com/2s9oaz7.jpg

提前致谢 干杯

, 标记

How can I change the 'Title' Label in creating a specific event using Drupal 5.
I am using the event module . Do I need to hack the core codes of Drupal?

My current URL add event node is:

http://cec5/bhutan/?q=en/node/add/event

Screenshot:
alt text http://i29.tinypic.com/2s9oaz7.jpg

Thanks in advance

Cheers,
Mark alt text

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

人心善变 2024-08-11 14:02:56

转到内容类型,您将看到网站内容类型的列表。在“操作”下,单击要更改标题的内容类型的“编辑”。在提交表单设置下,您可以更改“标题字段标签”

Go to Content type, you will have a list of content types of your site. Under Operations click on edit for the content type you want to change the title. Under Submission form settings you can change the "Title field label"

世界如花海般美丽 2024-08-11 14:02:56

解决了,感谢 Eumir 先生呵呵:D

function event_form_alter($form_id, &$form) {
    $node = isset($form['#node']) ? $form['#node'] : NULL;

    $form['venue'] = array(
        '#type' => 'textfield',
        '#title' => t('Venue'),
        '#default_value' => $node->venue
    );
    if (($form_id == "event_node_form") && isset($form['title']['#title'])) {
        // Change title to Name
        $form['title']['#title'] = t('Name');
        $form['body']['#body'] = t('Description');
    }
}

Solved it, thanks to Sir Eumir hehe :D

function event_form_alter($form_id, &$form) {
    $node = isset($form['#node']) ? $form['#node'] : NULL;

    $form['venue'] = array(
        '#type' => 'textfield',
        '#title' => t('Venue'),
        '#default_value' => $node->venue
    );
    if (($form_id == "event_node_form") && isset($form['title']['#title'])) {
        // Change title to Name
        $form['title']['#title'] = t('Name');
        $form['body']['#body'] = t('Description');
    }
}
梨涡 2024-08-11 14:02:56

如果适合您的用例,您还可以使用 自动 Nodetitles 完全删除标题字段。以下是其项目页面的摘录:

...一个小而高效的模块,允许隐藏表单中的内容标题字段。为了防止内容标题字段为空,可以将其配置为按给定模式生成标题。

安装Token模块后,可以使用各种节点数据来自动生成标题 - 例如使用 CCK 字段的文本(自 5.x 起)。

高级用户还可以提供一些PHP代码,用于自动生成合适的标题。

You can also use Automatic Nodetitles to get rid of the title field altogether if that fits your use case. Here is an excerpt from its project page:

... a small and efficient module that allows hiding of the content title field in the form. To prevent empty content title fields one can configure it to generate the title by a given pattern.

When the Token module is installed it's possible to use various node data for the auto generated title - e.g. use the text of a CCK field (since 5.x).

Advanced users can also provide some PHP code, that is used for automatically generating an appropriate title.

农村范ル 2024-08-11 14:02:55

您可以从管理界面更改标题和正文标签。

转到 yoursite.com/admin/content/types/event

You can change the title and body labels from the admin interface.

Go to yoursite.com/admin/content/types/event

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文