function inline_conditions_entity_metadata_field_property_set in Inline Conditions 7
Callback for setting field property values.
TODO: to be tested...
1 string reference to 'inline_conditions_entity_metadata_field_property_set'
- inline_conditions_field_property_callback in ./
inline_conditions.module - Property callback for IC module.
File
- ./
inline_conditions.module, line 313 - Extends Drupal 7 with a new field type to manage rules conditions directly from a field.
Code
function inline_conditions_entity_metadata_field_property_set($entity, $name, $value, $langcode, $entity_type) {
$field = field_info_field($name);
$langcode = entity_metadata_field_get_language($entity_type, $entity, $field, $langcode);
$values = $field['cardinality'] == 1 ? array(
$value,
) : (array) $value;
$items = array();
foreach ($values as $delta => $value) {
if (isset($delta)) {
$items[$delta] = $value;
}
}
$entity->{$name}[$langcode] = $items;
// Empty the static field language cache, so the field system picks up any
// possible new languages.
drupal_static_reset('field_language');
}