1
我構建了一個帶有選擇框(用戶可以選擇特定類型的用戶或項目或組)的簡單塊模塊,並且可以填寫搜索項。Drupal:在哪裏顯示自定義搜索結果
提交時,查詢具有這些標籤的節點。
結果,用戶配置文件或節點的鏈接必須打印在頁面上。
我不知道如何打印結果。
我想轉到另一個頁面,並在那裏顯示結果...但我該怎麼做?
<?php
// $Id$
/*
* @file
* Searches on Project, Person, Freelancer or Group. Search will be done on taxonomy.
*/
define('GENERAL_TAGS_VID', 25);
/**
* Implementation of hook_menu().
*/
function vm_search_menu() {
$items['zoek'] = array(
'title' => t('Zoek'),
'page callback' => 'zoek_view',
'access arguments' => array('search content'),
'type' => MENU_SUGGESTED_ITEM,
);
return $items;
}
/**
* Define the form.
*/
function vm_search_general_search_form() {
$search_on = array(
'project' => 'Zoek project',
'freelancer' => 'Zoek freelancer',
'persoon' => 'Zoek persoon',
'groep' => 'Zoek groep',
);
$form['search_on'] = array(
'#type' => 'select',
'#options' => $search_on,
);
$form['search_term'] =
array('#type' => 'textfield',
'#autocomplete_path' => 'taxonomy/autocomplete/'. GENERAL_TAGS_VID,
'#maxlength' => 1024,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Zoek'),
);
return $form;
}
function vm_search_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks[0]['info'] = t('General Search');
return $blocks;
case 'view':
$block['subject'] = t('Zoek');
$block['content'] = drupal_get_form('vm_search_general_search_form');
return $block;
}
}
function vm_search_general_search_form_submit($form, &$form_state) {
switch ($form_state['values']['search_on']) {
case 'project':
case 'groep':
$nodes = search_nodes($form_state);
break;
case 'freelancer':
case 'persoon':
$users = search_users($form_state);
}
dpm($form_state);
}