function formdefaults_edit_form in Form Defaults 5.3
Same name and namespace in other branches
- 6.2 formdefaults.admin.inc \formdefaults_edit_form()
- 7 formdefaults.admin.inc \formdefaults_edit_form()
1 string reference to 'formdefaults_edit_form'
- formdefaults_edit in ./
formdefaults.module - Edit form defaults
File
- ./
formdefaults.admin.inc, line 187
Code
function formdefaults_edit_form() {
$formid = arg(1);
$fieldname = arg(2);
drupal_set_title(t('Edit Form @formid', array(
'@formid' => $formid,
)));
// Load the form
$data = formdefaults_getform($formid);
$form['formid'] = array(
'#type' => 'value',
'#value' => $formid,
);
foreach ($data as $f => $field) {
if (strpos($f, '#') !== 0) {
$t = $field['title'] ? ' - ' . $field['title'] : '';
$fields[$f] = l($f . $t, 'formdefaults/' . $formid . '/' . urlencode($f));
}
}
$form['fields'] = array(
'#type' => 'checkboxes',
'#title' => 'Overriden Fields',
'#options' => $fields,
);
$form['add'] = array(
'#type' => 'fieldset',
'#title' => 'Add Fields',
'#collapsible' => true,
'#collapsed' => true,
);
$types = array(
'markup' => 'Markup',
'fieldset' => 'Collapsed fieldset with markup ',
);
$form['add']['field_type'] = array(
'#type' => 'select',
'#title' => 'Type',
'#options' => $types,
'#description' => 'Choose Markup to add a place for instructions that are always seen. Choose ',
);
// Weight of
$weight_range = range(-10, 10);
$weights = array(
'unset' => 'unset',
);
foreach ($weight_range as $weight) {
$weights[(string) $weight] = (string) $weight;
}
$form['add']['weight'] = array(
'#type' => 'select',
'#title' => 'Weight',
'#options' => $weights,
'#default_value' => -9,
'#description' => 'Controls placement within the form, -9 is a good header value or 10 is usually a good footer value',
);
$form['add']['add_submit'] = array(
'#type' => 'submit',
'#value' => 'Add',
);
$form['reset'] = array(
'#type' => 'submit',
'#value' => 'Reset Selected',
);
return $form;
}