function scanner_admin_form in Search and Replace Scanner 5.2
Same name and namespace in other branches
- 6 scanner.module \scanner_admin_form()
- 7 scanner.admin.inc \scanner_admin_form()
Search and Replace Settings form.
Return value
$form
1 string reference to 'scanner_admin_form'
- scanner_menu in ./
scanner.module - Implementation of hook_menu().
File
- ./
scanner.module, line 913 - Search and Replace Scanner - works on all nodes text content.
Code
function scanner_admin_form() {
drupal_set_title('Scanner Settings');
$table_map = _scanner_get_selected_tables_map();
sort($table_map);
foreach ($table_map as $item) {
$output .= '<li><b>' . $item['type'] . ':</b> ' . $item['field'];
if ($item['on']) {
$output .= t('on !on', array(
'!on' => $item['on'],
));
}
$output .= '</li>';
}
$form['selected'] = array(
'#type' => 'fieldset',
'#title' => t('Current Settings'),
'#collapsible' => TRUE,
);
$form['selected']['info']['#value'] = '<p>Fields that will be searched (in [nodetype: fieldname] order):</p><ul>' . $output . '</ul>';
$form['settings'] = array(
'#type' => 'fieldset',
'#title' => t('Scanner Options'),
'#collapsible' => TRUE,
);
$form['settings']['scanner_mode'] = array(
'#type' => 'checkbox',
'#title' => t('Default: Case Sensitive Search Mode'),
'#default_value' => variable_get('scanner_mode', 0),
);
$form['settings']['scanner_wholeword'] = array(
'#type' => 'checkbox',
'#title' => t('Default: Match Whole Word'),
'#default_value' => variable_get('scanner_wholeword', 0),
);
$form['settings']['scanner_regex'] = array(
'#type' => 'checkbox',
'#title' => t('Default: Regular Expression Search'),
'#default_value' => variable_get('scanner_regex', 0),
);
$form['settings']['scanner_published'] = array(
'#type' => 'checkbox',
'#title' => t('Default: Search Published Nodes Only'),
'#default_value' => variable_get('scanner_published', 1),
);
$form['settings']['scanner_rebuild_teasers'] = array(
'#type' => 'checkbox',
'#title' => t('Rebuild Teasers on Replace'),
'#default_value' => variable_get('scanner_rebuild_teasers', 1),
'#description' => t('If this box is checked: The teasers for any nodes that are modified in a search-and-replace action will be rebuilt to reflect the replacements in other fields; you do not need to check any teaser fields for nodes in the "Fields" section below. If this box is unchecked: Teasers will remain untouched; you can select specific teaser fields below to include in search-and-replaces.'),
);
if (module_exists('taxonomy')) {
$vocabularies = taxonomy_get_vocabularies();
if (count($vocabularies)) {
$options = array();
foreach ($vocabularies as $vocabulary) {
$options[$vocabulary->vid] = $vocabulary->name;
}
$form['settings']['scanner_vocabulary'] = array(
'#type' => 'checkboxes',
'#title' => t("Allow restrictions by terms in a vocabulary"),
'#options' => $options,
'#default_value' => variable_get('scanner_vocabulary', array()),
);
}
}
$form['tables'] = array(
'#type' => 'fieldset',
'#title' => t('Fields that can be searched'),
'#description' => t('Fields are listed in [nodetype: fieldname] order:'),
'#collapsible' => TRUE,
);
$table_map = _scanner_get_all_tables_map();
sort($table_map);
foreach ($table_map as $item) {
$key = 'scanner_' . $item['field'] . '_' . $item['table'] . '_' . $item['type'];
$form['tables'][$key] = array(
'#type' => 'checkbox',
'#title' => '<b>' . $item['type'] . ':</b> ' . $item['field'],
'#default_value' => variable_get($key, FALSE),
);
}
$form['scanner_custom'] = array(
'#type' => 'textarea',
'#title' => t('Custom Fields'),
'#default_value' => variable_get('scanner_custom', NULL),
'#description' => "one per row, <i>field</i> in <i>table</i> of type <i>nodetype</i> on <i>vid or nid</i>",
);
return system_settings_form($form);
}