Postponed
Project:
Multi-column checkboxes radios
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
14 Oct 2010 at 08:06 UTC
Updated:
26 Feb 2014 at 00:52 UTC
Jump to comment: Most recent
Comments
Comment #1
mattyoung commented>As a plugin/field type for webform?
Do you have any information on how to do this?
Comment #2
dries arnoldsThere's an API available: http://drupal.org/node/886014
You can also look at other modules that interact with webform.
Comment #3
mattyoung commentedI'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 invocationhook_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.Comment #4
mattyoung commentedI 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.
Comment #5
dries arnoldsGreat 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?
Comment #6
mattyoung commented>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.
Comment #7
mattyoung commentedI think I've done all I can for now. Will see what quicksketch come up with and then decide what else to do.
Comment #8
SanSan-1 commentedThis 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?
Comment #9
mattyoung commented>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.
Comment #10
SanSan-1 commentedThank 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!
Comment #11
mattyoung commentedCck is supported
Comment #12
inteja commentedI'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.
Comment #13
mattyoung commentedany update to this?
From Mt. Emei, China
Comment #14
sdsheridanSeems to be rendering an empty table. Something in the render isn't working. Any resolution?
Shawn
Comment #15
sdsheridanFigured 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 inhook_elements(), but in fact overrides the'#process'array elements from_element_info()in the form_builder, which meansexpand_radios()never gets called. Removing the linesolved 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