我创建了一个模块来自动编辑节点内容。该站点正在使用“Workbench Moderation”模块。
但我不知道如何让节点复制到新修订版中(处于“草稿”状态)。我编辑的内容始终出现在节点的“已发布”版本中。
有谁知道 API 调用应该是什么来实现这一点?
最佳答案
我自己就是有这个问题。关键事项:
Drupal 负责其余的工作。
<?php
$node = node_load($nid);
$node->body[LANGUAGE_NONE][0]['value'] = 'My new body content';
// We're wanting drupal to create a new revision
$node->revision = 1;
// We want workbench moderation to treat the new revision as a new draft
$node->workbench_moderation_state_new = workbench_moderation_state_none();
node_save($node);
这目前在我的代码库中工作。
关于drupal-7 - 如何使用 Drupal Workbench Moderation 以编程方式创建 "draft"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25575370/