function rb_cck_action_copy_multiple in Rules Bonus Pack 6
Action for 'rb_cck_action_copy_multiple'.
File
- ./
rb_cck.module, line 578 - Functions for extending CCK field management with Rules.
Code
function rb_cck_action_copy_multiple($source, $target, $settings) {
// Loop through all fields that should be copied.
foreach ($settings['fields_to_copy'] as $field) {
// If we shouldn't copy empty fields, don't copy empty fields. (Yeah, you
// heard me!) Note that we first check the skip_emtpy setting, to avoid
// running the somewhat heavy rb_cck_field_is_empty function more than
// necessary.
if ($settings['skip_empty'] == 0 || !rb_cck_field_is_empty($field, $source)) {
$target->{$field} = $source->{$field};
}
}
// If we should copy the title, copy the title.
if ($settings['copy_title']) {
$target->title = $source->title;
}
// Return the target node for saving by Rules.
return array(
'target' => $target,
);
}