fieldset.inc in Webform 5
File
components/fieldset.inc
View source
<?php
function _webform_edit_fieldset($currfield) {
$edit_fields = array();
$edit_fields['extra']['collapsible'] = array(
'#type' => 'checkbox',
'#title' => t("Collapsible"),
'#default_value' => $currfield['extra']['collapsible'],
'#description' => t('If this fieldset is collapsible, the user may open or close the fieldset.'),
'#weight' => 0,
);
$edit_fields['extra']['collapsed'] = array(
'#type' => 'checkbox',
'#title' => t("Collapsed by Default"),
'#default_value' => $currfield['extra']['collapsed'],
'#description' => t('Collapsible fieldsets are "open" by default. Select this option to default the fieldset to "closed."'),
'#weight' => 3,
);
$edit_fields['mandatory'] = array();
return $edit_fields;
}
function _webform_render_fieldset($component) {
$form_item = array(
'#type' => $component['type'],
'#title' => htmlspecialchars($component['name'], ENT_QUOTES),
'#weight' => $component['weight'],
'#description' => _webform_filtervalues($component['extra']['description']),
'#collapsible' => $component['extra']['collapsible'],
'#collapsed' => $component['extra']['collapsed'],
'#attributes' => array(
"class" => "webform-component-" . $component['type'],
"id" => "webform-component-" . $component['form_key'],
),
);
if ($component['extra']['width'] > 0) {
$form_item['#size'] = $component['extra']['width'];
}
return $form_item;
}
function _webform_submission_display_fieldset($data, $component, $enabled = false) {
$form_item = _webform_render_fieldset($component);
return $form_item;
}
function _webform_help_fieldset($section) {
switch ($section) {
case 'admin/settings/webform#fieldset_description':
$output = t("Fieldsets allow you to organize complex webforms into groups of fields.");
break;
}
return $output;
}
Functions
Name |
Description |
_webform_edit_fieldset |
Create a set of form items to be displayed on the form for editing this
component. Use care naming the form items, as this correlates directly to the
database schema. The component "Name" and "Description" fields are added to
every… |
_webform_help_fieldset |
Module specific instance of hook_help(). |
_webform_render_fieldset |
Build a form item array containing all the properties of this component. |
_webform_submission_display_fieldset |
Display the result of a fieldset submission. The output of this function will
be displayed under the "results" tab then "submissions". |