I have as default 'promote' on for the synced types. However this attribute is not set when nodes are created on alfresco and synced to drupal.
I fixed it like this:
in function _cmis_sync_cmis_drupal_prepare
// load Drupal node
$node = node_load($drupal_nid);
$node->type = $node_type;
if (!isset($drupal_nid)) {
// Set the node's defaults... (copied this from node and comment.module)
$node_options = variable_get('node_options_'. $node->type, array('status', 'promote'));
$node->status = in_array('status', $node_options);
$node->promote = in_array('promote', $node_options);
if (module_exists('comment')) {
$node->comment = variable_get("comment_$node->type", COMMENT_NODE_READ_WRITE);
}
}
and just before node_save I added a node_submit ( a habit?)
$node = node_submit($node);
// save Drupal node
node_save($drupal_node);
Comments
Comment #1
cbalan commentedHey bwynants,
You're right. We do need a way of passing defaults for drupal nodes.
But I would like to handle this in a more generic way which could also cover cmis object defaults.
So I was thinking to reuse 'fields' option from 'cmis_sync' conf variable to cover this kind of situations as well.
I'm thinking something like this:
What do you think ?
Anyway, until we'll have this in trunk, in order to avoid local patches, feel free to use hook_sync_cmis_drupal_prepare() to do any changes to synced nodes.
Thank you,
Catalin Balan
Comment #2
IanNorton commentedClosing 6.x issues as documented in this post