Hi I'm working in a menu component, similar to the one in the howtos. The menuItem template looks like:
<t:content> <li> <t:if test="isPage"> <t:pageLink page="prop:page" class="prop:className">${pageTitle}</t:pageLink> <p:else> <a href="#" class="${className}">${pageTitle}</a> </p:else> </t:if> <ul> <t:body/> </ul> </li> </t:content> however this template still renders an empty <ul> if there is no body. I would like to conditionally display the ul depending if there is a body or not. Something like: <t:if test="hasBody"> <ul> <t:body/> </ul> </t:if> Now, I have solved this implementing the hasBody method like: @Inject private ComponentResources resources; public boolean getHasBody() { Block block = resources.getBody(); if ("<PlaceholderBlock>".equals(block.toString())) { return false; } return true; } This works but seems a bit flaky. Is there a better way to figure out if a block is empty? Regards, Manuel.