function _field_sql_storage_write_compare_filter
Cleanup field values for later values comparison.
Parameters
array $field: Field info as returned by field_info_field_by_id().
array $array: Field values to cleanup.
Return value
array Filtered values.
1 call to _field_sql_storage_write_compare_filter()
- _field_sql_storage_write_compare in modules/
field/ modules/ field_sql_storage/ field_sql_storage.module - Compare a single field value for both entities and tell us if it changed.
File
-
modules/
field/ modules/ field_sql_storage/ field_sql_storage.module, line 468
Code
function _field_sql_storage_write_compare_filter($field, $array) {
foreach ($array as $language => $items) {
if (empty($items)) {
unset($array[$language]);
}
else {
foreach ($items as $delta => $item) {
// This should not happen but some modules provide invalid data to the
// field API.
if (!is_array($item)) {
continue;
}
// Let's start by pruning empty values and non storable values.
$array[$language][$delta] = array_filter(array_intersect_key($item, $field['columns']), '_field_sql_storage_write_compare_filter_callback');
// Ordering is important because for widget elements and loaded columns
// from database order might differ and give false positives on field
// value change, especially with complex fields such as image fields.
ksort($array[$language][$delta]);
}
}
}
return $array;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.