Active
Project:
Compact Forms
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Nov 2011 at 15:45 UTC
Updated:
23 Nov 2011 at 15:45 UTC
I'm not sure whether to report this here or at http://drupal.org/project/webform_simplenews, and I'm not sure whether it can be fixed anyway.
The webform simplenews component creates not one but several form elements, within the webform component wrapper, as there is an email address element and optionally a newsletter selection component.
This means that the label is higher up in the form array, and so doesn't get moved into the email address component. But then, I'm not sure how CF could be expected to figure out which of the two components to move the label into -- the first one maybe?
Here's the relevant form generating code in _webform_render_newsletter_email():
$element = array(
// This label has nowhere to be compacted into.
'#title' => htmlspecialchars($component['name'], ENT_QUOTES),
'#title_display' => $component['extra']['title_display'] ? $component['extra']['title_display'] : 'before',
'#required' => $component['mandatory'],
'#weight' => $component['weight'],
'#prefix' => '<div class="webform-component-'. $component['type'] .'" id="webform-component-'. $component['form_key'] .'">',
'#suffix' => '</div>',
'#webform_component' => $component,
'#theme' => 'webform_newsletter_email',
'#element_validate' => array('_webform_validate_newsletter_email'),
);
$element['newsletter_email_address'] = array(
// Adding a #title here makes the label work correctly
'#type' => 'textfield',
'#default_value' => $default_value,
'#attributes' => $component['extra']['attributes'],
'#field_prefix' => empty($component['extra']['field_prefix']) ? NULL : check_plain($component['extra']['field_prefix']),
'#field_suffix' => empty($component['extra']['field_suffix']) ? NULL : check_plain($component['extra']['field_suffix']),
'#size' => $size,
);