<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
It is quite possible that I don't understand properly what you're trying to do, but I think a slightly different approach is warranted, because you'll have a hard time getting the nesting to work since your children array is only going to be one level deep, and drupal_render is always going to wrap your checkboxes in form item div tags (I think).&nbsp;<div><br></div><div>Option 1 Storing a hierarchical array of values in #options and render the items in a bulleted list using theme_checkbox() calls in your custom theme. Just return the rendered text rather than walking the #children array. &nbsp;This is more akin to the first approach in the document that I sent you, only running bulleted lists instead of using theme_table. &nbsp;This assumes you want a flat array back and not a hierarchy of values.&nbsp;</div><div><br></div><div>Option 2 would be to &nbsp;think about implementing a custom form element and writing your own expand (or process in D7) function. &nbsp;The expand function would build the right hierarchy with appropriate #tree=TRUE and theme functions for the individual checkboxes theme_li_checkbox maybe and theme_ul_checkbox &nbsp;to build the checkbox array correctly. See the expand_checboxes (d6) for a better example of how #options gets converted to child elements.&nbsp;</div><div><br></div><div>Hope one of these approaches helps.&nbsp;</div><div><br></div><div>Dave</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br><div><div><div><div>On Jan 14, 2010, at 10:21 AM, Steve Edwards wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">I figured out the problem with the custom checkboxes theme function and drupal_render. &nbsp;Basically, drupal_render is assuming that I will render all of the children checkboxes in my custom theme function, so it doesn't do it itself. &nbsp;I just took the code from drupal_render and modified it slightly, and my children checkboxes are rendered:<div><br></div><div><div>&nbsp;&nbsp;// Code from drupal_render()</div><div>&nbsp;&nbsp;$children = element_children($element);</div><div>&nbsp;&nbsp;foreach ($children as $key) {</div><div>&nbsp;&nbsp; &nbsp;$content .= drupal_render($element[$key]);</div><div>&nbsp;&nbsp;}</div><div>&nbsp;&nbsp;</div><div>&nbsp;&nbsp;$element['#children'] = $content;</div><div><br></div><div>However, now I have another problem, and that is that the #title and #description values are being displayed twice. &nbsp;Stepping through the code shows that two theme functions are being called twice: theme_checkboxes in form.inc AND my custom theme checkboxes function. &nbsp;What I don't understand is why, since I explicitly defined a theme function for my checkboxes form element in my form definition:</div><div><br></div><div>&nbsp;&nbsp;$form['site_sections'] = array(</div><div>&nbsp;&nbsp; &nbsp;'#type' =&gt; 'checkboxes',</div><div>&nbsp;&nbsp; &nbsp;'#title' =&gt; t('Site Sections'),</div><div>&nbsp;&nbsp; &nbsp;'#options' =&gt; $options,</div><div>&nbsp;&nbsp; &nbsp;'#description' =&gt; t('Test description'),</div><div>&nbsp;&nbsp; &nbsp;'#theme' =&gt; 'section_permissions_checkboxes',</div><div>&nbsp;&nbsp;);&nbsp;</div><div><br></div><div>This is even further demonstrated by looking at the rendered HTML for the form.</div><div><br></div><div><div class="nodeLabel "><div class="nodeLabel "><span aria-expanded="true" class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">form</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">section-permissions-admin-form</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">method</span>="<span class="nodeValue editable ">post</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">accept-charset</span>="<span class="nodeValue editable ">UTF-8</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">action</span>="<span class="nodeValue editable ">/user/6/section_permissions</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "><div class="nodeBox containerNodeBox  repIgnore  open"><div class="nodeLabel "><img class="twisty "><span aria-expanded="true" class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "><div class="nodeBox containerNodeBox  repIgnore  open"><div class="nodeLabel "><img class="twisty "><span aria-expanded="true" class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "><div class="nodeBox textNodeBox  repIgnore  selected"><div class="nodeLabel "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">label</span><span class="nodeBracket editable insertBefore ">&gt;</span><span class="nodeText editable ">Site Sections: </span>&lt;/<span class="nodeTag ">label</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore  open"><div class="nodeLabel "><img class="twisty "><span aria-expanded="true" class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-checkboxes</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "><div class="nodeBox containerNodeBox  repIgnore  open"><div class="nodeLabel "><img class="twisty "><span aria-expanded="true" class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "><div class="nodeBox textNodeBox  repIgnore "><div class="nodeLabel "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">label</span><span class="nodeBracket editable insertBefore ">&gt;</span><span class="nodeText editable ">Site Sections: </span>&lt;/<span class="nodeTag ">label</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore  open"><div class="nodeLabel "><img class="twisty "><span aria-expanded="true" class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-checkboxes</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-917-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-918-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-923-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-924-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-925-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-926-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-927-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-928-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-919-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-929-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-930-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-931-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-932-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-920-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-933-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-934-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-921-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-935-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-936-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-937-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-938-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox containerNodeBox  repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-922-wrapper</span>"</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox textNodeBox  repIgnore "><div class="nodeLabel "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">description</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span><span class="nodeText editable ">Test description</span>&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div><div class="nodeBox textNodeBox  repIgnore "><div class="nodeLabel "><span class="nodeLabelBox repTarget ">&lt;<span class="nodeTag ">div</span><span class="nodeAttr editGroup ">&nbsp;<span class="nodeName editable ">class</span>="<span class="nodeValue editable ">description</span>"</span><span class="nodeBracket editable insertBefore ">&gt;</span><span class="nodeText editable ">Test description</span>&lt;/<span class="nodeTag ">div</span>&gt;</span></div></div></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget ">&lt;/<span class="nodeTag ">div</span>&gt;</span></div><div class="nodeCloseLabel "><br></div><div class="nodeCloseLabel ">Can anyone explain why this is happening?</div><div class="nodeCloseLabel "><br></div><div class="nodeCloseLabel ">Thanks.</div><div class="nodeCloseLabel "><br></div><div class="nodeCloseLabel ">Steve</div></div></div></div></div></div></div><div><br><div><br><div>Begin forwarded message:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>From: </b></span><span style="font-family:'Helvetica'; font-size:medium;">Steve Edwards &lt;<a href="mailto:killshot91@gmail.com">killshot91@gmail.com</a>&gt;<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>Date: </b></span><span style="font-family:'Helvetica'; font-size:medium;">January 14, 2010 7:36:41 AM PST<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>To: </b></span><span style="font-family:'Helvetica'; font-size:medium;"><a href="mailto:development@drupal.org">development@drupal.org</a><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>Subject: </b></span><span style="font-family:'Helvetica'; font-size:medium;"><b>Re: [development] Creating embedded unordered lists of checkboxes</b><br></span></div><br><div>Well, the problem with that is I've tried just that (creating my own custom checkboxes function), and as I said in the initial post, when it gets to my custom theme_checkboxes form, the #children have not been rendered since that step was skipped in drupal_render() simply because #theme was set for the checkboxes element. &nbsp;If I could get to my custom theme_checkboxes element with $element['#children'] set, I'd be fine, but that's what's throwing the wrench into things.<br><br>Thanks.<br><br>Steve<br><br><br><br>On Jan 13, 2010, at 7:39 PM, David Metzler wrote:<br><br><blockquote type="cite">I think you're on the right track. &nbsp;Check out:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><a href="http://drupal.org/node/197578">http://drupal.org/node/197578</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">which shows you how to render &nbsp;a checkboxes control into a table. &nbsp;&nbsp;&nbsp;You shouldn't technically need the form-item theme function to do what you're doing, but rather just a custom checkboxes theming form. &nbsp;&nbsp;I've done that successfully in D5, but it looks like it would work in D6. &nbsp;Note the direct calls to theme_checkbox in that function so that it renders each of the checkboxes properly<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Hope that helps,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Dave<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On Jan 13, 2010, at 4:54 PM, Steve Edwards wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">I have a need to create a two-level unordered list of checkboxes from a two level taxonomy vocabulary. &nbsp;So for instance, if my vocabulary is<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">- Level 1 term 1<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-- Level 2 term 1<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-- Level 2 term 2<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-- Level 2 term 3<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">- Level 1 term 2<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-- Level 2 term 4<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-- Level 2 term 5<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">- Level 1 term 3<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I want to create the following:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">&lt;ul&gt;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">&lt;li&gt;&lt;input type = checkbox"&gt;Level 1 term 1&lt;/li&gt;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">&lt;ul&gt;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&lt;li&gt;&lt;input type = checkbox"&gt;.Level 2 term 1&lt;/li&gt;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&lt;li&gt;&lt;input type = checkbox"&gt;Level 2 term 2&lt;/li&gt;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&lt;li&gt;&lt;input type = checkbox"&gt;Level 2 term 3&lt;/li&gt;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">&lt;/ul&gt;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">&lt;li&gt;&lt;input type = checkbox"&gt;Level 1 term 2&lt;/li&gt;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">&lt;ul&gt;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&lt;li&gt;&lt;input type = checkbox"&gt;Level 2 term 4&lt;/li&gt;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&lt;li&gt;&lt;input type = checkbox"&gt;Level 2 term 5&lt;/li&gt;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">&lt;ul&gt;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">&lt;li&gt;&lt;input type = checkbox"&gt;Level 1 term 3&lt;li&gt;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">&lt;/ul&gt;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">What is the best way to do this? &nbsp;Just use a checkboxes element type and create my own theme function for the form? &nbsp;Modify something like theme_item_list? &nbsp;Or is there a better (and easier) way that I'm missing?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">What I tried doing was to create a theme function for my checkboxes element by setting the #theme property for the element to my custom theme function (and registering the function in hook_theme). &nbsp;I then just made a copy of theme_checkboxes() (and theme_form_element since it's called from theme_form_checkboxes) and renamed to match hook_theme and the #theme property. &nbsp;However, when doing that, none of my checkboxes are rendered at all. &nbsp;On stepping through the code, I found the problem in drupal_render starting at line 2868:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> if (!isset($elements['#children'])) {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;$children = element_children($elements);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;// Render all the children that use a theme function.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;if (isset($elements['#theme']) &amp;&amp; empty($elements['#theme_used'])) {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;$elements['#theme_used'] = TRUE;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;$previous = array();<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;foreach (array('#value', '#type', '#prefix', '#suffix') as $key) {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$previous[$key] = isset($elements[$key]) ? $elements[$key] : NULL;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;}<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;// If we rendered a single element, then we will skip the renderer.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;if (empty($children)) {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$elements['#printed'] = TRUE;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;}<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;else {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$elements['#value'] = '';<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;}<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;$elements['#type'] = 'markup';<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;unset($elements['#prefix'], $elements['#suffix']);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;$content = theme($elements['#theme'], $elements);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;foreach (array('#value', '#type', '#prefix', '#suffix') as $key) {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$elements[$key] = isset($previous[$key]) ? $previous[$key] : NULL;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;}<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;}<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;// Render each of the children using drupal_render and concatenate them.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;if (!isset($content) || $content === '') {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;foreach ($children as $key) {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$content .= drupal_render($elements[$key]);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;}<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;}<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> }<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">So basically, because I have #theme set for the checkboxes field, it skips the rendering of the individual checkbox elements. &nbsp;To me, it makes sense that I override the theme function for the checkboxes type since that's the element type, but that doesn't seem to be the case. &nbsp;So what do I need to do to be able to simply theme my checkboxes element?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Thanks.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Steve<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><br></blockquote><br></div></blockquote></div><br></div></div></blockquote></div><br></div></div></div></body></html>