function autofill_form in Autofill 6
Implementation of Autofill settings form.
1 string reference to 'autofill_form'
- autofill_menu in ./
autofill.module - Implements hook_menu().
File
- ./
autofill.admin.inc, line 12 - Adminstrative page callbacks for Autofill
Code
function autofill_form() {
$path = 'sites/default/files';
if (file_exists($path . '/autofill.js')) {
drupal_set_message(t('Custom Autofill config file at %path. Please remove this file to use the system generated version.', array(
'%path' => 'sites/default/files/autofill.js',
)), 'error');
return $form;
}
// Add Autofill form CSS
$path = drupal_get_path('module', 'autofill');
drupal_add_css($path . '/autofill.css');
$form = array();
$form['autofill_colour_default'] = array(
'#type' => 'textfield',
'#title' => t('Default Text Color'),
'#default_value' => variable_get('autofill_colour_default', '#ccc'),
'#attributes' => array(
'class' => 'field_spacing',
),
'#description' => t('Helptip colour for empty fields.'),
);
$form['autofill_colour_active'] = array(
'#type' => 'textfield',
'#title' => t('Active Text Color'),
'#default_value' => variable_get('autofill_colour_active', '#333'),
'#attributes' => array(
'class' => 'field_spacing',
),
'#description' => t('Color of autofill fields when being edited'),
);
$form['fields'] = array(
'#type' => 'fieldset',
'#title' => t('Fill in autofill fields'),
'#description' => t('Please note that you have to right click to view source and find the correct variables.'),
'#collapsible' => FALSE,
'#collapsed' => FALSE,
'#prefix' => '<div class="autofill-row">',
'#suffix' => '</div">',
);
// Get fields.
$fields = variable_get('autofill_id_field_combos', array());
$count = 0;
foreach ($fields as $delta => $field) {
$form['fields'][] = _autofill_textfield_combo($delta, $field['id'], $field['value'], $field['pre']);
$count = $delta;
}
// Default empty field as a last row.
$form['fields'][] = _autofill_textfield_combo($count + 1, '', '', '');
// Use custom submit handler.
$form['buttons']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
'#submit' => array(
'autofill_settings_form_submit',
),
);
// Add form validation.
$form['#validate'] = array(
'autofill_settings_form_validate',
);
return $form;
}