function rules_condition_data_list_contains
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 400
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);
}