protected function FormTest::components in Form Builder 7.2
Provide example components for the tests.
2 calls to FormTest::components()
- FormTest::testConfigurationForm in modules/
webform/ tests/ FormTest.php - Test the element configuration form.
- FormTest::testPreview in modules/
webform/ tests/ FormTest.php - Test the form builder preview.
File
- modules/
webform/ tests/ FormTest.php, line 15
Class
- FormTest
- Integration test for the webform integration.
Namespace
Drupal\form_builder_webformCode
protected function components() {
$components = array(
1 => array(
'nid' => 1,
'cid' => 1,
'form_key' => 'fieldset1',
'name' => 'fieldset1',
'type' => 'fieldset',
'value' => '',
'extra' => array(
'conditional_operator' => '=',
'conditional_component' => '',
'conditional_values' => '',
),
'required' => 0,
),
3 => array(
'nid' => 1,
'cid' => 3,
'pid' => 1,
'form_key' => 'hour',
'name' => 'hour',
'type' => 'time',
'extra' => array(
'title_display' => 'before',
'conditional_operator' => '=',
'conditional_component' => '',
'conditional_values' => '',
),
'weight' => 2,
),
2 => array(
'nid' => 1,
'cid' => 2,
'pid' => 0,
'form_key' => 'textfield1',
'name' => 'textfield1',
'type' => 'textfield',
'value' => 'textfield1',
'extra' => array(
'title_display' => 'before',
'disabled' => 1,
'unique' => 0,
'conditional_operator' => '=',
'width' => '4',
'maxlength' => '',
'field_prefix' => 'testprefix',
'field_suffix' => 'testpostfix',
'conditional_component' => '',
'conditional_values' => '',
),
'weight' => 1,
),
4 => [
'type' => 'grid',
'form_key' => 'grid',
],
5 => [
'type' => 'select',
'form_key' => 'select',
'extra' => [
'items' => "1|one\n2|two\n3|three",
],
],
);
foreach ($components as $cid => &$component) {
webform_component_defaults($component);
$component += [
'cid' => $cid,
'pid' => 0,
'nid' => 1,
];
}
return $components;
}