function rules_condition_data_list_contains in Rules 7.2
Condition: List contains.
Related topics
1 call to rules_condition_data_list_contains()
- rules_action_data_list_add in modules/
data.eval.inc - Action: Add a list item.
1 string reference to 'rules_condition_data_list_contains'
- rules_data_condition_info in modules/
data.rules.inc - Implements hook_rules_condition_info() on behalf of the pseudo data module.
File
- modules/
data.eval.inc, line 392 - Contains rules integration for the data module needed during evaluation.
Code
function rules_condition_data_list_contains($list, $item, $settings, $state) {
$wrapper = $state->currentArguments['item'];
if ($wrapper instanceof EntityStructureWrapper && ($id = $wrapper
->getIdentifier())) {
// Check for equal items using the identifier if there is one.
foreach ($state->currentArguments['list'] as $i) {
if ($i
->getIdentifier() == $id) {
return TRUE;
}
}
return FALSE;
}
return in_array($item, $list);
}