4
我尝试使用下面的代码从外部脚本添加一个新的节点:如何在Drupal 7中为节点设置自定义字段值?
define('DRUPAL_ROOT', getcwd());
include_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$node = new stdClass();
$node->title = "Your node title";
$node->body = "The body text of your node.";
$node->type = 'rasskazi';
$node->created = time();
$node->changed = $node->created;
$node->status = 1; // Published?
$node->promote = 0; // Display on front page?
$node->sticky = 0; // Display top of page?
$node->format = 1; // Filtered HTML?
$node->uid = 1; // Content owner uid (author)?
$node->language = 'en';
node_submit($node);
node_save($node);
但是如何设置自定义字段值(“SUP_ID”整数为例)?
Upvote for Clive! –