Commit 197f516a authored by Joel Muzzerall's avatar Joel Muzzerall
Browse files

Issue #2598926 by jmuzz: Fix for PHP versions < 5.3

parent 4869c3e7
......@@ -588,10 +588,7 @@ function field_collection_item_is_empty(FieldCollectionItemEntity $item) {
$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';
});
$all_boolean = $instances && !(bool) array_filter('_field_collection_field_is_not_boolean');
foreach ($instances as $instance) {
$field_name = $instance['field_name'];
......@@ -624,6 +621,14 @@ function field_collection_item_is_empty(FieldCollectionItemEntity $item) {
return $is_empty;
}
/**
* Callback used by array_filter in field_collection_is_empty.
*/
function _field_collection_field_is_not_boolean($instance) {
$field = field_info_field($instance['field_name']);
return $field['type'] != 'list_boolean';
}
/**
* Implements hook_field_formatter_info().
*/
......
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