Closed (fixed)
Project:
Webform
Version:
6.x-3.6
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
20 May 2010 at 23:43 UTC
Updated:
27 Oct 2015 at 16:32 UTC
Jump to comment: Most recent
There have been a couple threads about this (such as http://drupal.org/node/695146) and I thought it worth requesting the change.
Right now the Description field is appearing after the Form Component field (eg textfield, etc...) when the webform is viewed. Since this is supposed to be help text for the Form Component field, can it be moved to appear between the Label and the Form Component field?
| Comment | File | Size | Author |
|---|---|---|---|
| Description-text.png | 71.05 KB | RedRock2512 |
Comments
Comment #1
quicksketchWebform does not have control over this theming, it uses the normal output as provided by Drupal core. The ONLY way we can change this is to provide entirely new theme functions for all form elements (which in Drupal core is around 8 or so). This isn't a practical task to accomplish, considering it'd be duplicating hundreds of lines of code. The good news however is that this limitation has been fixed in Drupal core, but we have to wait until Drupal 7 to take advantage of it. Since 3.x is maintained in sync between Drupal 6 and Drupal 7, we're probably looking at well over a year before this can be practically implemented, and it will never be implemented in Drupal 6.
That said, you can theme all form elements on your personal site just fine by overridding theme_form_element() within your theme.
Comment #2
pietro.a commentedSubscribing, for what it's worth.
Comment #3
paul.dambra commentedFWIW here's the code I used to "fix" this in Drupal 6. My theme is called bmc_zen replace that in the below as appropriate and add this to your theme's template.php
Obviously check your template.php for this function just in case :) Hope that helps someone.
Comment #4
quicksketchI should note that in Drupal 7 we do in fact have a separate theme function for webform form elements now: theme_webform_element(), which is exactly like theme_form_element() only it is specific to Webform fields, so you can move just the description of Webform elements now (in D7 only). As I said above, this unfortunately isn't possible in Drupal 6.
I'm going to go ahead and mark this fixed as a support request, since as a feature it's already as far as we'll take it.
Comment #6
baisongI modified one line to suppress disabled component titles from being displayed:
if (!empty($element['#title'])) {should be
if (!empty($element['#title']) && ($element['#title_display'] != 'none')) {Comment #7
roblogThanks for the fix Paul - works a treat.
Comment #8
markosef commentedI am often surprised by lack of insight by module creators. There is so much top down approaches in drupal, so many divs and inner divs in theming and then you need to put a simple description in front of the field and you can't do it. What was developer of this module thinking? Like, ok, description has to be always after the field and that is it. If someone wants it before, they can make custom code. So why all the robustness when you fail at simple but often needed function? I just don't get it how can someone design something like that, really can somebody explain that?
Comment #9
dpedu commentedSorry for the necromancy - but the above Drupal 7 solutions above break some features of webform conditionals.
For the most up-to-date way to do this, copy the function theme_webform_element in webform.module into your theme and copy the:
Section up into the switch statement before the line where $element['#children'] is appended to $output.
But I agree with the other commenters - this would be a nice feature to have as part of webform.
Comment #10
katannshaw commentedThank you @dpedu for comment #9! That helped me out thoroughly.
Comment #11
modiphier commentedHello,
Trying this on a zen child theme in drupal 6 and its not doing anything. Any suggestions or a better solution to this issue yet?
Thanks,
paul
Comment #12
danchadwick commentedThere is no support or development for the D6 branch, other than security issues. Maybe someone else can help you.
This is now a standard feature of the D7 branch though. Not that that helps you.