Commit 6f8ad926 authored by Joel Muzzerall's avatar Joel Muzzerall
Browse files

Merge branch '7.x-1.x' of git.drupal.org:project/field_collection into 7.x-1.x

parents 09a4419d c07b3eca
......@@ -476,6 +476,9 @@ function field_collection_field_update($host_entity_type, $host_entity, $field,
$entity->default_revision = TRUE;
$entity->archived = FALSE;
}
else {
$entity->default_revision = FALSE;
}
}
$entity->save(TRUE);
......@@ -587,10 +590,22 @@ function field_collection_item_is_empty(FieldCollectionItemEntity $item) {
$instances = field_info_instances('field_collection_item', $item->field_name);
$is_empty = TRUE;
// Check whether all fields are booleans.
$all_boolean = $instances && !(bool) array_filter($instances, function ($instance) {
$field = field_info_field($instance['field_name']);
return $field['type'] != 'list_boolean';
});
foreach ($instances as $instance) {
$field_name = $instance['field_name'];
$field = field_info_field($field_name);
// Boolean fields as those are always considered non-empty, thus their
// information is not useful and can be skipped by default.
if (!$all_boolean && $field['type'] == 'list_boolean') {
continue;
}
// Determine the list of languages to iterate on.
$languages = field_available_languages('field_collection_item', $field);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment