I'm trying to create a custom module that has a block with a form in it. I'm able to install my module, and even add the block to the content area of the site, showing my form on every page of the site. But for some reason the page I set as the form's page won't show up in the navigation, and when I try to type in the pages address to get to it, it says the page is not found.
<?php
require_once('/includes/functions.php');
/**
* @file
*
*/
/**
* Implements hook_block_menu()
*/
function search_engine_menu() {
$items = array();
$items['results_page'] = array(
'title' => 'Search Results',
'page callback' => 'search_engine_results_page',
'access callback' => TRUE,
'type' => MENU_NORMAL_ITEM,
);
}
/**
* Implements hook_block_info().
*/
function search_engine_block_info() {
$blocks = array();
$blocks['search_engine'] = array(
'info' => t('Search Engine'),
'cache'=> DRUPAL_CACHE_GLOBAL,
);
return $blocks;
}
/**
* Implements hook_block_view().
*/
function search_engine_block_view($delta = ''){
$block = array();
switch ($delta) {
case 'search_engine':
$block['subject'] = t('Search Engine');
$block['content'] = drupal_get_form('search_engine_form');
}
return $block;
}
/**
* Implements hook_form.
*/
function search_engine_form ($form, &$form_state){
$form['searchOptions'] = array(
'#type' => 'select',
'#title' => t('You can search by GWF Number, name, email address or phone number.'),
'#options' => array(
'gwf' => t('GWF Number'),
'applicant_email' => t('Email Address'),
'name' => t('Name'),
'phone_number' => t('Phone Number'),
),
'#value' => 'gwf',
);
$form['searchInput'] = array(
'#type' => 'textfield',
'#title' => t(''),
);
$form['submit'] = array(
'#type' => 'submit',
'#value'=> t('Submit'),
);
$form['results'] = array(
'#type' => 'markup',
'#value'=> 'Test',
);
return $form;
}
/**
* Implements hook_form_submit.
*/
function search_engine_form_submit($form, &$form_state){
drupal_set_message('Submitted');
}