function workbench_moderation_node_export_node_alter in Workbench Moderation 7.3
Same name and namespace in other branches
- 7 workbench_moderation.module \workbench_moderation_node_export_node_alter()
Implements hook_node_export_node_alter().
Manipulate a node on export.
Parameters
&$node: The node to alter.
$original_node: The unaltered node.
File
- ./
workbench_moderation.module, line 2392 - Content moderation for Workbench.
Code
function workbench_moderation_node_export_node_alter(&$node, $original_node) {
// Don't proceed if moderation is not enabled on this content type
if (!workbench_moderation_node_type_moderated($node->type)) {
return;
}
//Set the current state to be the same as the current revision's state.
if (!isset($node->workbench_moderation_state_current) && isset($node->workbench_moderation) && isset($node->workbench_moderation['current'])) {
$node->workbench_moderation_state_current = $node->workbench_moderation['current']->state;
}
// Set default moderation state values if they are not set.
if (!isset($node->workbench_moderation_state_current)) {
$node->workbench_moderation_state_current = $node->status ? workbench_moderation_state_published() : workbench_moderation_state_none();
}
if (isset($node->workbench_moderation_state_current)) {
// Set the new state to be the same as the current.
$node->workbench_moderation_state_new = $node->workbench_moderation_state_current;
}
//Node revisions will not be exported so remove moderation states tied to revisions
unset($node->workbench_moderation);
}