When setting the default setting for the label display field on a Fieldset component, it is not possible to enable this field by default.
File: "webform/compontents/fieldset.inc"
function _webform_defaults_fieldset() {
return array(
'name' => '',
'form_key' => NULL,
'pid' => 0,
'weight' => 0,
'extra' => array(
'title_display' => 1, // NOT WORKING
'collapsible' => 0,
'collapsed' => 0,
'description' => '',
'private' => FALSE,
),
);
}
A change in the "includes/webform.components.inc" file makes this option possible:
Changes @ line 429:
if (webform_component_feature($component['type'], 'title_inline')) {
$form['display']['title_display'] = array(
'#type' => 'select',
'#title' => t('Label display'),
'#default_value' => !empty($component['extra']['title_display']) ? $component['extra']['title_display'] : 'before',
'#options' => array(
'before' => t('Above'),
'inline' => t('Inline'),
'none' => t('None'),
),
'#description' => t('Determines the placement of the component\'s label.'),
);
}
else {
$form['display']['title_display'] = array(
'#type' => 'checkbox',
'#title' => t('Hide label'),
'#default_value' => ($component['extra']['title_display'] === 'none' ? TRUE : FALSE),
'#return_value' => 'none',
'#description' => t('Do not display the label of this component.'),
);
}
Before:
'#default_value' => strcmp($component['extra']['title_display'], 'none') === 0,
After:
'#default_value' => ($component['extra']['title_display'] === 'none' ? TRUE : FALSE),
The before version does not work because it returns a "1" if true instead of a "TRUE" value that is needed.
Comments
Comment #0.0
hoebekewim commentedChanged default_value, More information
Comment #1
danchadwick commentedtitle_display should never be set to 1. The allowed values are 0, 'inline', 'before', and 'none. 0 means "use default". In the current release, it is set to 0 for fieldset.