function search_exclude_nid_search_exclusion_form in Search exclude nid 7
Form constructor for the module's settings form.
See also
search_exclude_nid_search_exclusion_form_submit()
1 string reference to 'search_exclude_nid_search_exclusion_form'
- search_exclude_nid_menu in ./
search_exclude_nid.module - Implements hook_menu().
File
- ./
search_exclude_nid.admin.inc, line 15 - Administrative page callbacks for the redirect module.
Code
function search_exclude_nid_search_exclusion_form() {
$form = array();
$form['search_exclude_nid_search_exclusion_nids'] = array(
'#title' => t('Node ids to be excluded from search result'),
'#type' => 'textfield',
'#maxlength' => '1024',
'#default_value' => implode(',', variable_get('search_exclude_nid_search_exclusion_nids', array())),
'#description' => t('Please enter the node ids separated by a "," (for example: 1,23,45)'),
);
$form['search_exclude_nid_search_exclusion_auto'] = array(
'#title' => t('Node title lookup'),
'#type' => 'textfield',
'#autocomplete_path' => 'search_exclusion/autocomplete',
'#description' => t('Lookup a node title and copy & paste the node ID into the list field above or just press "Save configuration". The node ID will then be automatically added to the list.'),
);
$form['#attached']['js'] = array(
drupal_get_path('module', 'search_exclude_nid') . '/search_exclude_nid.js',
);
$excluded_nodes = search_exclude_nid_get_excluded_nodes();
if (count($excluded_nodes)) {
// List of excluded nodes.
$items = array();
foreach ($excluded_nodes as $excluded_node) {
$items[] = array(
'data' => l($excluded_node->title . ' (nid:' . $excluded_node->nid . ')', 'node/' . $excluded_node->nid),
'id' => 'excluded-node-' . $excluded_node->nid,
);
}
$form['exclusion_list'] = array(
'#type' => 'markup',
'#markup' => theme('item_list', array(
'items' => $items,
'title' => t('List of excluded nodes'),
'type' => 'ul',
'attributes' => array(),
)),
);
}
$form['#submit'][] = 'search_exclude_nid_search_exclusion_form_submit';
return system_settings_form($form);
}