function rules_condition_data_is_assertions
Asserts the bundle of entities, if it's compared.
If the bundle is compared, add the metadata assertion so other elements can make use of properties specific to the bundle.
Related topics
File
-
modules/
data.rules.inc, line 614
Code
function rules_condition_data_is_assertions($element) {
// Assert the bundle of entities, if it's compared.
if ($wrapper = $element->applyDataSelector($element->settings['data:select'])) {
$info = $wrapper->info();
if (isset($info['parent']) && $info['parent'] instanceof EntityDrupalWrapper) {
$entity_info = $info['parent']->entityInfo();
if (isset($entity_info['entity keys']['bundle']) && $entity_info['entity keys']['bundle'] == $info['name']) {
// Assert that the entity is of bundle $value.
$value = is_array($element->settings['value']) ? $element->settings['value'] : array(
$element->settings['value'],
);
// Chop of the last part of the selector.
$parts = explode(':', $element->settings['data:select'], -1);
return array(
implode(':', $parts) => array(
'bundle' => $value,
),
);
}
}
}
}