I like the idea of this module, but the writing a module just to add the functionality to a webform will put off a lot of users.

Is it possible to interface with webform in a more standard way? As a plugin/field type for webform?

Comments

mattyoung’s picture

>As a plugin/field type for webform?

Do you have any information on how to do this?

dries arnolds’s picture

There's an API available: http://drupal.org/node/886014

You can also look at other modules that interact with webform.

mattyoung’s picture

I'm looking at the built-in select component to see what to do. I don't see the implementation of hook_webform_component_info() in webform for its built-in components. I cannot even find any invocation hook_webform_component_info() anywhere.

Seems to me it would be so much simpler if the webform module can just add multicolumn support into its built-in select component. If I add support to my module, it will be just 99% boiler plate copy of webform's select component and add the multicolumn parameter field to it.

Another good way to solve this problem is for webform to provide alter() hook so other module can extend webform components.

Do you know any module that is a webform component?

EDIT: never mind, I see the hook_webform_component_info() API is for 3.x. I have the 2.x version install.

mattyoung’s picture

I added direct support for webform. But this depends on the patch in #946956: Implement alter() hook to allow external module to extend existing components?

Apply that patch to webform, update multi-column checkboxes radios to the 'dev' version. You will then get the Multi-column configuration fieldset in the "Display" section of the "Select" component. Set the parameters there and you will get multi-column display.

dries arnolds’s picture

Great work Matt. I really appreciate your efforts!

Edit: oh I just saw Quicksketch's answer. Is there any hope of reaching this solution through component insert or other methodes mentioned by him?

mattyoung’s picture

>Is there any hope of reaching this solution through component insert or other methodes mentioned by him?

I don't think so. What Quicksketch is talking about deals with the data part of webform component. I need to change the edit form and the rendering of the Select component. My alter() hook patch make this possible in a very straight forward drupal way: Drupal and many modules have lots of alter hooks.

As far as performance impact goes, I believe it should be minimal. Drupal itself does alter hooks all over the place so the overhead of drupal_alter() and the module lookup inside it is already done and cached. Most of the time, the alter hooks I added don't exist so there is really little overhead other than the call to drupal_alter().

Try to convince Quicksketch to reconsider. Those alter hooks make webform much more flexible when you need to extend some webform component. Without them, webform components are not extendable.

mattyoung’s picture

Status: Active » Postponed

I think I've done all I can for now. Will see what quicksketch come up with and then decide what else to do.

SanSan-1’s picture

This module is exactly what I need but I am not a programmer so I can't touch the code. Can I use this module without writing code?

mattyoung’s picture

>Can I use this module without writing code?

For webform, no. You need to apply the patch in http://drupal.org/node/946956#comment-3602722

then you don't need to do any programming. After the patch, you configure the multi-column display options in the component edit form for checkboxes/radios.

On how to work with patch: http://drupal.org/patch/apply

If you apply the patch to webform, you need to use the "dev" version of this module to get the functionality I described.

SanSan-1’s picture

Thank you so much for your answer! Actually I don't want to use it for Webform but just for a CCK checkbox field in order to arrange the list in a nicer way, that is to say not one item under the other but rather in a grid way. This would allow me to have a shorter output page. Is that the module correct for me?
Thanks again!

mattyoung’s picture

Cck is supported

inteja’s picture

I've applied the patch to Webform 6.x-3.9 and am using the latest dev version (2011-02-25) of Multi-column checkboxes radios. When editing the select element it now lets me specify multiple columns etc, but they are still not getting displayed when the form is viewed - it renders divs rather than a table.

Any ideas? This is driving me a little nuts.

mattyoung’s picture

any update to this?

From Mt. Emei, China

sdsheridan’s picture

Issue summary: View changes

Seems to be rendering an empty table. Something in the render isn't working. Any resolution?

Shawn

sdsheridan’s picture

Figured out why after stepping through the code. In function multicolumncheckboxesradios_webform_component_render_alter, setting $element['#process'][] is not only unnecessary because that is already accomplished in hook_elements(), but in fact overrides the '#process' array elements from _element_info() in the form_builder, which means expand_radios() never gets called. Removing the line

$element['#process'][] = 'multicolumncheckboxesradios_element_process';

solved the issue for me, and now the radios are rendering in a table.

Would be great to get this into a next, production-ready release of the module. :)

Shawn