function rules_forms_action_attribute_set in Rules Forms Support 7.2
Action: Set the value of an element attribute.
1 string reference to 'rules_forms_action_attribute_set'
- rules_forms_rules_action_info in ./
rules_forms.rules.inc - Implements hook_rules_action_info().
File
- includes/
rules_forms.eval.inc, line 158 - Evaluation functions for Rules Forms module.
Code
function rules_forms_action_attribute_set(EntityMetadataWrapper $wrapper, $value, $settings, $state, $element) {
if ($wrapper instanceof EntityValueWrapper) {
try {
// If this attribute type defines a setter callback then we use that.
$info = $wrapper
->info();
if (isset($info['attribute info']['setter callback']) && is_callable($info['attribute info']['setter callback'])) {
$info['attribute info']['setter callback']($wrapper, $value);
}
else {
$wrapper
->set($value);
}
} catch (EntityMetadataWrapperException $e) {
throw new RulesEvaluationException('Unable to modify data "@selector": ' . $e
->getMessage(), array(
'@selector' => $settings['data:select'],
));
}
}
else {
return array(
'data' => $value,
);
}
}