I'm not sure whether multicolumns are supposed to function or not within user registration and/or profile fields. I have Profile Checkboxes enabled to convert the list selection field into a sequence of checkboxes, and doing an array dump I found the multicolumn attribute to already be included, which I ultimately modified to set the width to 3 columns to no avail. I'm not sure whether this functionality (i.e. having multicolumns work with non-CCK profiles) is supposed to be included or whether I'm actually encountering a bug in that there is no change in the layout of my user registration.

Thanks

Comments

mattyoung’s picture

>I found the multicolumn attribute to already be included

How does this happen? I looked at the source of profile_checkboxes.module and don't see doing this.

>I ultimately modified to set the width to 3 columns

How do you make the modification?

Can I see the dump of the form array?

cyberm4tic’s picture

Sure, and again thanks for the help.

When I do a dump of the array in user-register.tpl.php without any tampering, I get this:

Array
(
    [#type] => fieldset
    [#title] => Athletic Information
    [#weight] => 2
    [profile_sports] => Array
        (
            [#type] => checkboxes
            [#title] => Current Sports
            [#default_value] => Array
                (
                    [0] => 
                )

            [#options] => Array
                (
                    a bunch of junk etc... etc...
                )

            [#description] => Sports you are currently playing.
            [#required] => 0
            [#post] => Array
                (
                )

            [#programmed] => 
            [#tree] => 1
            [#parents] => Array
                (
                    [0] => profile_sports
                )

            [#array_parents] => Array
                (
                    [0] => Athletic Information
                    [1] => profile_sports
                )

            [#weight] => 0
            [#processed] => 1
            [#attributes] => Array
                (
                )

            [#input] => 1
            [#process] => Array
                (
                    [0] => expand_checkboxes
                    [1] => multicolumncheckboxesradios_element_process
                )

            [#multicolumn] =>

And I make the modification by altering the form in the template file as such
$form['Athletic Information']['profile_sports']['#multicolumn'] = array('width' => 6);

I then pass the form through drupal_render. Judging from your response, this was not how the modification was intended to be made. I initially understood it as a module that allowed you manipulate FAPI directly.

Either way, I used the profiles checkbox module to create a list selection profile field that substituted checkboxes for the old-school method of CNTRL and click as many choices as are suitable.

mattyoung’s picture

I see the #multicolumn stuff is there. Something must be setting it. I wonder how that gets there because profile_checkboxes is not doing it, at least I don't see it in the source that I can tell.

+++ where do you find the user-register.tpl.php file? I can't find it.

The problem is drupal form building doesn't work the way you expect: you cannot feed the form array to drupal_render() and expect to get the correct result. All forms are created by drupal_get_form() which internally goes through a form building process that do a lot of things to the form array, after that, then finally drupal_render_form() is called to render out the HTML. The version of the form array you are seeing is raw, it hasn't gone though the form building process inside drupal_get_form().

What you need is to make a module and implement hook_form_FORM_ID_alter(). Something like this:

HOOK_form_user_register_alter(&$form, &$form_state) {
  $form['Athletic Information']['profile_sports']['#multicolumn'] = array('width' => 6);
}
mattyoung’s picture

Status: Active » Closed (works as designed)

~

salientknight’s picture

I'm a little confused about part of the answer. Does this work with the User Registration profil_checkboxes?

Thank you,

-=Sal=-

mattyoung’s picture

No it does not. You need to implement hook_form_alter() to change to profile_checkboxes form element