While working on issue #1482958: Allow field_group with empty fields to be displayed via setting (comment #27) I found out this function description and name confusing/conflicting:

/**
 * Determine if an element has non-empty children.
 */
function _field_group_is_empty_element($element, $entity, $childname, $groups) {}

So does it determine non-empty children or empty element? Or is it just me not understanding?

Comments

iMiksu created an issue.

morbiD’s picture

Totally agree that this function is confusing.

I believe the description is "correct" since the function returns TRUE when the element has non-empty children. However, that means the function is returning the opposite of what the name implies.

I mean, if I'm calling a function named is_empty_element() on an element with child content, I expect it to return FALSE; not TRUE.

Given what the function actually does, it should be named element_has_children() or something like that.