function date_node_deploy in Deploy - Content Staging 6
Implementation of hook_node_deploy().
Parameters
$node: The node we're deploying.
Return value
The results of our xmlrpc call.
File
- modules/
date_deploy/ date_deploy.module, line 115
Code
function date_node_deploy(&$node) {
// There is a bug somewhere in the FAPI munging in node_deploy() that
// causes date values to get trashed. In order to get around this, we
// actually need to node_load() each node as it comes through in order
// to retrieve the original date value. !shoot($messenger)
$original_node = node_load($node->nid);
// If we couldn't load it then bail.
if (!($original_node = node_load($node->nid))) {
return;
}
$fields = date_deploy_get_date_fields();
foreach ($fields as $field_name => $field) {
if (property_exists($original_node, $field_name)) {
foreach ($original_node->{$field_name} as $key => $date_value) {
if (!is_null($date_value['value'])) {
unset($node->{$field_name});
$node->{$field_name}[$key] = date_deploy_rebuild_date($date_value, $field);
}
}
}
}
}