function _webform_edit_matrix in Webform Matrix Component 7.4
Same name and namespace in other branches
- 6 components/matrix.inc \_webform_edit_matrix()
- 7 components/matrix.inc \_webform_edit_matrix()
- 7.2 components/matrix.inc \_webform_edit_matrix()
- 7.3 components/matrix.inc \_webform_edit_matrix()
Implements _webform_edit_component().
File
- components/
matrix.inc, line 56 - Webform module matrix component.
Code
function _webform_edit_matrix($component) {
$form = array();
$max_rows = variable_get('webform_matrix_component_webform_matrix_rows', 30);
$form['extra']['matrix_row'] = array(
'#type' => 'select',
'#title' => t('Matrix Rows'),
'#options' => array_combine(range(1, $max_rows), range(1, $max_rows)),
'#default_value' => isset($component['extra']['matrix_row']) ? $component['extra']['matrix_row'] : "1",
'#weight' => 0,
'#parents' => array(
'extra',
'matrix_row',
),
);
$form['extra']['add_row_feature'] = array(
'#type' => 'checkbox',
'#title' => t('Add row feature'),
'#default_value' => isset($component['extra']['add_row_feature']) ? $component['extra']['add_row_feature'] : 0,
'#weight' => 1,
'#parents' => array(
'extra',
'add_row_feature',
),
'#return_value' => 1,
);
$form['extra']['remove_row_feature'] = array(
'#type' => 'radios',
'#title' => t('Remove row feature'),
'#default_value' => isset($component['extra']['remove_row_feature']) ? $component['extra']['remove_row_feature'] : 0,
'#weight' => 1,
'#parents' => array(
'extra',
'remove_row_feature',
),
'#options' => array(
1 => "Per Matrix single button",
2 => "Row wise delete button",
0 => "Not Required",
),
);
$form['extra']['add_row_button_text'] = array(
'#type' => 'textfield',
'#title' => t('Add row button text'),
'#default_value' => isset($component['extra']['add_row_button_text']) ? $component['extra']['add_row_button_text'] : t('Add a row'),
'#weight' => 2,
'#parents' => array(
'extra',
'add_row_button_text',
),
'#required' => 1,
'#states' => array(
// Hide the settings when the cancel notify checkbox is disabled.
'invisible' => array(
':input[name="extra[add_row_feature]"]' => array(
'checked' => FALSE,
),
),
),
);
$form['extra']['remove_row_button_text'] = array(
'#type' => 'textfield',
'#title' => t('Remove row button text'),
'#default_value' => isset($component['extra']['remove_row_button_text']) ? $component['extra']['remove_row_button_text'] : t('Remove a row'),
'#weight' => 2,
'#parents' => array(
'extra',
'remove_row_button_text',
),
'#required' => 1,
'#states' => array(
// Hide the settings when the cancel notify checkbox is disabled.
'visible' => array(
':input[name="extra[remove_row_feature]"]' => array(
'value' => 2,
),
),
),
);
$form['extra']['remove_row_header_text'] = array(
'#type' => 'textfield',
'#title' => t('Remove row header text'),
'#default_value' => isset($component['extra']['remove_row_header_text']) ? $component['extra']['remove_row_header_text'] : t('Remove action'),
'#weight' => 2,
'#parents' => array(
'extra',
'remove_row_header_text',
),
'#states' => array(
// Hide the settings when the cancel notify checkbox is disabled.
'invisible' => array(
':input[name="extra[remove_row_feature]"]' => array(
'value' => 0,
),
),
),
);
return $form;
}