function rb_cck_action_remove_value_multiple in Rules Bonus Pack 6
Action for 'rb_cck_action_remove_value_multiple'.
File
- ./
rb_cck.module, line 491 - Functions for extending CCK field management with Rules.
Code
function rb_cck_action_remove_value_multiple($node, $settings) {
// Get required metadata for the field.
$storage_key = rb_cck_field_storage_key($settings['field']);
// Check if the value is present in the multiple-value field.
foreach ($node->{$settings['field']} as $key => $existing_value) {
if ($settings['value'] == $existing_value[$storage_key]) {
// If we have a match, remove this entry and send off the node for saving.
unset($node->{$settings['field']}[$key]);
return array(
'node' => $node,
);
}
}
// If we don't have a match, just return. There is no need to save anything.
return;
}