<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). <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. This is more akin to the first approach in the document that I sent you, only running bulleted lists instead of using theme_table. This assumes you want a flat array back and not a hierarchy of values. </div><div><br></div><div>Option 2 would be to think about implementing a custom form element and writing your own expand (or process in D7) function. 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 to build the checkbox array correctly. See the expand_checboxes (d6) for a better example of how #options gets converted to child elements. </div><div><br></div><div>Hope one of these approaches helps. </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. 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. I just took the code from drupal_render and modified it slightly, and my children checkboxes are rendered:<div><br></div><div><div> // Code from drupal_render()</div><div> $children = element_children($element);</div><div> foreach ($children as $key) {</div><div> $content .= drupal_render($element[$key]);</div><div> }</div><div> </div><div> $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. Stepping through the code shows that two theme functions are being called twice: theme_checkboxes in form.inc AND my custom theme checkboxes function. 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> $form['site_sections'] = array(</div><div> '#type' => 'checkboxes',</div><div> '#title' => t('Site Sections'),</div><div> '#options' => $options,</div><div> '#description' => t('Test description'),</div><div> '#theme' => 'section_permissions_checkboxes',</div><div> ); </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 "><<span class="nodeTag ">form</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">section-permissions-admin-form</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">method</span>="<span class="nodeValue editable ">post</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">accept-charset</span>="<span class="nodeValue editable ">UTF-8</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">action</span>="<span class="nodeValue editable ">/user/6/section_permissions</span>"</span><span class="nodeBracket editable insertBefore ">></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 "><<span class="nodeTag ">div</span><span class="nodeBracket editable insertBefore ">></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 "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "><div class="nodeBox textNodeBox repIgnore selected"><div class="nodeLabel "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">label</span><span class="nodeBracket editable insertBefore ">></span><span class="nodeText editable ">Site Sections: </span></<span class="nodeTag ">label</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore open"><div class="nodeLabel "><img class="twisty "><span aria-expanded="true" class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-checkboxes</span>"</span><span class="nodeBracket editable insertBefore ">></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 "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "><div class="nodeBox textNodeBox repIgnore "><div class="nodeLabel "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">label</span><span class="nodeBracket editable insertBefore ">></span><span class="nodeText editable ">Site Sections: </span></<span class="nodeTag ">label</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore open"><div class="nodeLabel "><img class="twisty "><span aria-expanded="true" class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-checkboxes</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-917-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-918-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-923-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-924-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-925-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-926-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-927-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-928-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-919-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-929-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-930-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-931-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-932-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-920-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-933-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-934-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-921-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-935-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-936-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-937-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-938-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox containerNodeBox repIgnore "><div class="nodeLabel "><img class="twisty "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">id</span>="<span class="nodeValue editable ">edit-site-sections-922-wrapper</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">form-item</span>"</span><span class="nodeBracket editable insertBefore ">></span></span></div><div class="nodeChildBox "></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox textNodeBox repIgnore "><div class="nodeLabel "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">description</span>"</span><span class="nodeBracket editable insertBefore ">></span><span class="nodeText editable ">Test description</span></<span class="nodeTag ">div</span>></span></div></div></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></span></div></div><div class="nodeBox textNodeBox repIgnore "><div class="nodeLabel "><span class="nodeLabelBox repTarget "><<span class="nodeTag ">div</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">class</span>="<span class="nodeValue editable ">description</span>"</span><span class="nodeBracket editable insertBefore ">></span><span class="nodeText editable ">Test description</span></<span class="nodeTag ">div</span>></span></div></div></div><div class="nodeCloseLabel "><span class="nodeCloseLabelBox repTarget "></<span class="nodeTag ">div</span>></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 <<a href="mailto:killshot91@gmail.com">killshot91@gmail.com</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>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. 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. 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 a checkboxes control into a table. You shouldn't technically need the form-item theme function to do what you're doing, but rather just a custom checkboxes theming form. I've done that successfully in D5, but it looks like it would work in D6. 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. 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"><ul><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><li><input type = checkbox">Level 1 term 1</li><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><ul><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> <li><input type = checkbox">.Level 2 term 1</li><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> <li><input type = checkbox">Level 2 term 2</li><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> <li><input type = checkbox">Level 2 term 3</li><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"></ul><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><li><input type = checkbox">Level 1 term 2</li><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><ul><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> <li><input type = checkbox">Level 2 term 4</li><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> <li><input type = checkbox">Level 2 term 5</li><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><ul><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><li><input type = checkbox">Level 1 term 3<li><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"></ul><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? Just use a checkboxes element type and create my own theme function for the form? Modify something like theme_item_list? 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). 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. However, when doing that, none of my checkboxes are rendered at all. 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"> $children = element_children($elements);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> // Render all the children that use a theme function.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> if (isset($elements['#theme']) && empty($elements['#theme_used'])) {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> $elements['#theme_used'] = TRUE;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> $previous = array();<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> foreach (array('#value', '#type', '#prefix', '#suffix') as $key) {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> $previous[$key] = isset($elements[$key]) ? $elements[$key] : NULL;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> }<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> // If we rendered a single element, then we will skip the renderer.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> if (empty($children)) {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> $elements['#printed'] = TRUE;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> }<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> else {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> $elements['#value'] = '';<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> }<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> $elements['#type'] = 'markup';<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> unset($elements['#prefix'], $elements['#suffix']);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> $content = theme($elements['#theme'], $elements);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> foreach (array('#value', '#type', '#prefix', '#suffix') as $key) {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> $elements[$key] = isset($previous[$key]) ? $previous[$key] : NULL;<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"> // Render each of the children using drupal_render and concatenate them.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> if (!isset($content) || $content === '') {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> foreach ($children as $key) {<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> $content .= drupal_render($elements[$key]);<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"> }<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. 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. 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>