function title_admin_settings_form in Title 7
Form settings for automated title_field attachment.
1 string reference to 'title_admin_settings_form'
- title_menu in ./
title.module - Implements hook_menu().
File
- ./
title.admin.inc, line 77 - Admin page callbacks for the Title module.
Code
function title_admin_settings_form() {
$form['tabs'] = array(
'#type' => 'vertical_tabs',
);
$form['settings']['title_general'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#tree' => TRUE,
'#group' => 'tabs',
'#title' => t('General'),
);
$general = variable_get('title_general', array(
'maxlength' => 255,
));
$form['settings']['title_general']['maxlength'] = array(
'#type' => 'textfield',
'#title' => t('Default maximum field length'),
'#description' => t('The default maximum length for the title field. This setting will have no effect once a title field for a specific entity type has been created, because the maximum field length is a global field setting and the databases tables will already have been created with a specific length.'),
'#element_validate' => array(
'element_validate_integer_positive',
),
'#default_value' => $general['maxlength'],
);
foreach (entity_get_info() as $entity_type => $info) {
if (empty($info['field replacement'])) {
continue;
}
$form['settings']['title_' . $entity_type] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#tree' => TRUE,
'#group' => 'tabs',
'#title' => check_plain($info['label']),
);
$options = array();
foreach (array_keys($info['field replacement']) as $replacement) {
$options[$replacement] = drupal_ucfirst($replacement);
}
$default = variable_get('title_' . $entity_type, array());
$form['settings']['title_' . $entity_type]['auto_attach'] = array(
'#type' => 'checkboxes',
'#title' => t('Automatic field replacement'),
'#options' => $options,
'#default_value' => !empty($default['auto_attach']) ? $default['auto_attach'] : array(),
'#description' => t('Automatically replace the selected field(s) when creating a new bundle.'),
);
$form['settings']['title_' . $entity_type]['hide_label'] = _title_hide_label_widget($default, $info['label']);
}
return system_settings_form($form);
}