Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
drupal.org
field_collection
Commits
6f8ad926
Commit
6f8ad926
authored
Feb 02, 2015
by
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
field_collection.module
field_collection.module
+15
-0
No files found.
field_collection.module
View file @
6f8ad926
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment