While all UI widgets support a "hidden" attribute that causes them to not be rendered, sometimes there is supporting HTML that surrounds the widget that also needs to be hidden. This is particularly common when optionally including data in a table, where you might want to exclude an entire row if a piece of data is missing.
This example hides a table row if the "name" field is hidden.
| Name: | Alan |
| City: | Memphis |
Code:
<table border="0" cellspacing="0" cellpadding="3">
{WFViewHiddenHelper id="name"}
<tr>
<td valign="top" align="right">Name:</td>
<td valign="top">{WFView id="name"}</td>
</tr>
{/WFViewHiddenHelper}
<tr>
<td valign="top" align="right">City:</td>
<td valign="top">{WFView id="city"}</td>
</tr>
</table>
WFViewHiddenHelper also works with WFDynamic's. This example hides "Alan" and "David".
Code:
<ul>
{section name=items loop=$__module->valueForKeyPath('People.arrangedObjectCount')}
{WFViewHiddenHelper id="listName"}<li>{WFDynamic id="listName"}</li>{/WFViewHiddenHelper}
{/section}
</ul>