custom/form_helper/form_helper_alter/form_helper_alter.admin.inc, line 11
form_helper_alter_admin_settings()Administration page for 'Form helper alter' module
<?php
function form_helper_alter_admin_settings() {
$form['form_alter'] = array(
'#type' => 'fieldset',
'#title' => t('Form alter settings'),
);
$form['form_alter']['form_helper_alter_form_alter_path'] = array(
'#type' => 'textfield',
'#title' => t('Path to the form alter include files'),
'#default_value' => variable_get('form_helper_alter_form_alter_path', 'sites/all/form_helper_alter'),
'#size' => 80,
'#maxlength' => 200,
);
// NOTE:
// The options keys (values) can not have a starting string hash (#) because the FAPI
// will consider them to be properties and not options which will throw an error.
$form_alter_properties_options = array(
'access' => '#access',
'after_build' => '#after_build',
'attributes' => '#attributes',
'autocomplete_path' => '#autocomplete_path',
'base' => '#base',
'button_type' => '#button_type',
'collapsed' => '#collapsed',
'collapsible' => '#collapsible',
'cols' => '#cols',
'default_value' => '#default_value',
'delta' => '#delta',
'description' => '#description',
'disabled' => '#disabled',
'field_prefix' => '#field_prefix',
'field_suffix' => '#field_suffix',
'maxlength' => '#maxlength',
'multiple' => '#multiple',
'options' => '#options',
'parents' => '#parents',
'prefix' => '#prefix',
'required' => '#required',
'return_value' => '#return_value',
'rows' => '#rows',
'size' => '#size',
'submit' => '#submit',
'suffix' => '#suffix',
'theme' => '#theme',
'title' => '#title',
'tree' => '#tree',
'validate' => '#validate',
'value' => '#value',
'weight' => '#weight',
);
$form_helper_alter_form_alter_properties = variable_get('form_helper_alter_form_alter_properties', array('attributes', 'default_value', 'description', 'options', 'title', 'type'));
// Remove hash (#) from all values
foreach ($form_helper_alter_form_alter_properties as $key => $value) {
$form_helper_alter_form_alter_properties[$key] = str_replace('#', '', $value);
}
$form['form_alter']['form_helper_alter_form_alter_properties'] = array(
'#type' => 'checkboxes',
'#title' => t('Properties to be included in form alter source code templates'),
'#description' => t('Goto the <a href="@forms_api_reference">Drupal forms API (FAPI) reference</a> for detailed information about each property.', array('forms_api_reference' => 'http://api.drupal.org/api/file/developer/topics/forms_api_reference.html')),
'#default_value' => $form_helper_alter_form_alter_properties ,
'#options' => $form_alter_properties_options
);
// Filter submitted values to return an array - http://api.drupal.org/api/function/system_settings_form_submit/6
$form['array_filter'] = array('#type' => 'value', '#value' => TRUE);
$form['#submit'][] = 'form_helper_alter_admin_settings_submit';
return system_settings_form($form);
}
?>