I may just be dim, but I've installed the module and the Readme seems to be for developers rather than Admin. Am I supposed to cut/paste something into something, somewhere, to make this work? If so, what, into where?

Comments

mattyoung’s picture

The port to D7 is incomplete. See http://drupal.org/node/842636#comment-3823656

dafeder’s picture

While we wait for the UI to be complete, I wrote a small helper module to turn this on on node fields I needed it for. For those interested:

<?php
function move_checkbox_helper_form_alter(&$form, &$form_state, $form_id) {
  // only apply to node forms
  if (preg_match('/_node_form$/', $form_id) && !empty($form['field_org'])) {
    if ($form['field_org'][$form['field_org']['#language']]['#type'] == 'checkboxes') {
      $form['field_org'][$form['field_org']['#language']]['#multicolumn'] = array(
        'width' => 3,
      );      
    }
  }
}
?>

(Obviously, replace "move_checkbox_helper" and "field_org" with your own module and field names. Also, array structure may be different for non-multilingual sites. A dsm($form['field_yourfield']) should clear that up.)

Babymaggie’s picture

Hi dafeder - Thanks for your little helper module - Do you think you can redo it without the multilanguage? I'm not a coder and do'nt really know what Im doing and got lost completely when you say "A dsm($form['field_yourfield']) should clear that up."

I tried all sorts but no luck ;-(

I added my field name field_categories in the 5 areas you have field_org

I tried adding it as a module in itself? Is this correct? or do I put it in the Multi-column checkboxes radios folder?

Please help as I have 14 categories which goes from the top to the bottom of the screen and this looks like a great way of making the layout look a lot more professional.

I wonder why Drupal does'nt have something like this built in?

If you could describe what to do in beginner talk I would be delighted!

Many thanks

dafeder’s picture

Babymaggie: yes, I'm suggesting implementing a new module. If you are confused about how to do that, start here:

http://drupal.org/node/1074360

The code above implements hook_form_alter(), which is documented on the Drupal API site. If you have the devel module installed and enabled, putting

dsm($form['field_categories']);

into that function will print the structure of that field to the screen, and let you see exactly what array elements need to be altered.

I wish it was easier too, but unfortunately right now there's no way to do this without getting your hands dirty.

Babymaggie’s picture

Thanks Dafeder for your help and taking the time to talk me through this.

You're a star!

damienmckenna’s picture

Subscribe. I'll probably take a look at this tomorrow..

TahitiPetey’s picture

Status: Active » Closed (works as designed)

For me, I had to insert it into the field's "und" array. On my side, it looked like this:

$form['field_jobbenefits']['und'] += array(
  '#multicolumn' => array('width' => 3),
);

Why is the array key named "und"? I have no idea... that had me stumped for the longest time since I thought it meant "undefined" (and thus unaddressable--that turned out not to be the case, however).

Also, I closed this bug report since it does work, it just needs a bit of hand-dirtying.

damienmckenna’s picture

Status: Closed (works as designed) » Active

@TahitiPetey: I think the point is that the module should work out of the box without any hackery when it currently doesn't. The 'und' thing is the default Drupal 7 value to indicate the language, but it should instead use the notation $node->language.

ydnar79’s picture

It has been a few months..... Just checking to see if anyone has had any success in converting this module to Drupal 7?

IWasBornToWin’s picture

Priority: Normal » Major

Same here, looking for solution.

mattyoung’s picture

I'm extremely busy working on another project unrelated to drupal, won't be able to devote any significant time on this. I haven't got any chance to look up how the new field api in D7 store widget settings info.The feature lacking for D7 is the UI to configure radios/checkboxes field widget to show in multi-column. I welcome anyone who know how the new field api store config info/insert additional widget config form element to provide help and guidance. At the meantime, this module is D7 ready programmatically. You can use HOOK_form_xxx_alter() make things works.

Thank you all...

nielsvoo’s picture

Category: bug » support

I just was curious when the d7 version is finished?

mattyoung’s picture

The D7 version doesn't have the field setting UI to set the multi-column parameters. You can use hook_form_alter()

IWasBornToWin’s picture

For those of us who do not know how to use hook form alter....will d7 version ever be so we do not have to do that?

Thanks

jorisx’s picture

yes, ... how would you use that hook form alter? do I put that in a template?

KristineC’s picture

Am also very interested in figuring out a way around this!

gmorgan140’s picture

Will this ever work with webforms in d7? I have looked all over and tried to add hooks but I have had no luck.

khan2ims’s picture

Hi,

I have got this module working using hook_form_alter(), but it doesn't show check all/ uncheck all toggle. How to add it? I don't see any property listed for this in readme.txt file.

Please help. Thanks!

IWasBornToWin’s picture

@khan can you please tell us what you did? Or upload code or a file?

Does anyone know if this module is still maintained?

mattyoung’s picture

Checkall is done with this: http://drupal.org/project/checkall

But there isn't a D7 version :(

khan2ims’s picture

Hi,

I did what was mentioned in comment #2, but instead of creating a new module, added the function to the multicolumncheckboxesradios.module file itself

    if (preg_match('/_node_form$/', $form_id) && !empty($form['field_habitat'])) {
    if ($form['field_habitat'][$form['field_habitat']['#language']]['#type'] == 'checkboxes') {
      $form['field_habitat'][$form['field_habitat']['#language']]['#multicolumn'] = array(
        'row-major' => TRUE,
        'width' => 5,
      );     
    }
  }

Cleared my cache and it worked! My main objective of using this module was check all function, but now looks like its not feature of this module.

zilla’s picture

there's some sample alterations of old code at https://drupal.org/node/1010284 - adapted to d7 and accounting for hook form alter (not sure if it's useful in this iteration, but hopefully it's helpful)

knalstaaf’s picture

There's a CSS workaround that doesn't require this module but does provide a layout in columns:

.form-radios .form-item,
.form-checkboxes .form-item {
    width: 48%; /* 2 columns in this case, use e.g. 30% for three columns etc */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    margin: 0px;
}

Just posting it here in case it would help anyone for the time being.

(Source)

josemanuel.velasco’s picture

Issue summary: View changes

Hello,

I've posted in drupalexchange my problem using the module. I'll appreciate if anybody could take a look and tell me what is wrong.

Basically I've done the alters but the checkboxes are still rendered as a list and not in columns.

Only local images are allowed.

Here is the post: http://drupal.stackexchange.com/questions/147155/multi-column-checkboxes...

Thanks in advance.