如何使用Drupal7中的规则预填充节点的字段?

发布于 2024-11-10 02:29:15 字数 102 浏览 0 评论 0原文

用户按下保存按钮后,使用规则可以轻松填充节点的字段值。只需在保存内容事件之前添加一条规则即可。但是,是否可以有一个规则来在向用户显示编辑表单之前预填充节点字段?因此他进行了更改以更正默认值。

Using rules it's easy to fill field values of a node after user pressed the save button. Just add a rule on before saving content event. But is it possible to have a rule to prefill a node field before edit form is shown to the user? So he has a change to corrent the default values.

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

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

发布评论

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

评论(3

寄居人 2024-11-17 02:29:15

这是一个很晚的回复,但希望有人可能会发现它有一些帮助:

如果您使用规则创建节点,您可以先保存它,选择“立即强制保存:true”。在下一步中,您可以设置节点字段的值。您可能需要再次保存。 (也可以立即“强制保存”。)在下一步中,对编辑网址执行“页面重定向”。

不确定这是否是一种优雅的方法,但它可能会起作用。我有一个有点类似的要求(不一样),这就是我最终做到的 - 首先保存,然后重定向到已保存节点的编辑 url。

This is a very late reply, but hopefully someone might find it to be of some help:

If you are creating the node using Rules, you could save it first, selecting "Force saving immediately: true". In the next step, you could set the value of the node field. You might need to save again. (also 'Force save' immediately.) And in the next step, do a 'page redirect' to the edit url.

Not sure if this is an elegant way to do it, but it might work. I had a somewhat similar requirement (not the same), and this is how I finally did that - by saving first, and then redirecting to the edit url of the saved node.

泪眸﹌ 2024-11-17 02:29:15

不确定这是否可以通过规则来完成,但是如果您转到“结构”->“内容类型”,您可以单击“管理字段”并编辑除标题字段之外的任何字段的默认值(您始终可以关闭并替换为具有默认值的自定义标题字段)

Not sure if this is something you can accomplish with rules or not, but if you go to structure->content types you can click "manage fields" and edit the default value of any field other than the title field (which you could always turn off and replace with a custom title field with a default value)

就此别过 2024-11-17 02:29:15

我认为基本上有两种方法可以做到这一点:

1)使用规则表单。我对这个模块不太了解,并且我对该模块有一些不太完美的体验,但我相当确定它可以用该模块完成。

2) 使用规则创建节点,填充相关字段值,然后将用户发送到编辑页面。这种方法的一个缺点是,如果用户决定中止节点创建,您最终会得到一个填充了一半的节点,需要以某种方式删除。

如果您选择选择选项 2,并且对页面管理器和面板感到满意,那么可能值得查看规则窗格模块。

I think there are basically two ways of doing this:

1) Use Rules Forms. I don't know very much about that module, and I have had some less than perfect experiences with the module, but I'm fairly certain it could be done with the module.

2) Use Rules to create a node, populate the relevant field values, and then send the user to the edit page. One downside with this approach is that if the user decides to abort the node creation, you'll end up with a half-populated node that needs deletion in one way or another.

If you choose to go for option 2, and are comfortable with Page manager and Panels, it is probably worth checking out the Rules Panes module.

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