Download & Extend

Taxonomy reference field prints label for empty fields

Project:Hierarchical Select
Version:7.x-3.0-alpha5
Component:Code - Taxonomy
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

When using the hs_taxonomy field formatters, the field label is printed even when the field is empty. This is because of the #attached property being added to the render array. Even though the render array has no children, that property must be enough for the field label to still print.

Here's a patch that just returns early in the field formatter process if the field is empty. An upside of this is that it also saves on a couple taxonomy term/vocabulary loads if the field is empty as well.

AttachmentSize
hs_taxonomy-empty_field_label.patch670 bytes

Comments

#1

Version:7.x-3.x-dev» 7.x-3.0-alpha5

And the patch for alpha-5. Thanks theunraveler for the code.

AttachmentSize
blank_field_1762608.patch 822 bytes