You are here

function rb_cck_condition_in_multiple in Rules Bonus Pack 6

The 'rb_cck_condition_in_multiple' condition.

File

./rb_cck.module, line 348
Functions for extending CCK field management with Rules.

Code

function rb_cck_condition_in_multiple($node, $settings) {

  // Get required metadata for the field.
  $storage_key = rb_cck_field_storage_key($settings['field']);

  // Build an array of all the values to search for.
  $values = explode("\r", $settings['values']);

  // Check each field value to see if it matches the provided list. If so
  // return TRUE.
  foreach ($node->{$settings['field']} as $key => $field) {
    if (in_array($field[$storage_key], $values)) {
      return TRUE;
    }
  }

  // If no match was found, return FALSE.
  return FALSE;
}