ถ้าฟังก์ชั่นไหนของเราไม่ใช่ฮุก เราต้องบอกให้ Drupal รับรู้ถึงฟังก์ชั่นเราเสมอ
ทำได้ผ่านฮุก onthisdate_menu() โดยกลับไปแก้ไขงานจากคราวก่อน
<?php
function onthisdate_menu() {
$items = array();
//this was created earlier in tutorial 7.
$items['admin/settings/onthisdate'] = array(
'title' => 'On this date module settings',
'description' => 'Description of your On this date settings control',
'page callback' => 'drupal_get_form',
'page arguments' => array('onthisdate_admin'),
'access arguments' => array('access administration pages'),
'type' => MENU_NORMAL_ITEM,
);
//this is added for this current tutorial.
$items['onthisdate'] = array(
'title' => 'On this date',
'page callback' => 'onthisdate_all',
'access arguments' => array('access onthisdate content'),
'type' => MENU_CALLBACK
);
return $items;
}
?>onthisdate ฟังก์ชั่น onthisdate_all() จะทำงานtype) ของเมนู คือ
MENU_NORMAL_ITEM เป็นเมนูปกติที่ผู้ใช้มองเห็นMENU_CALLBACK ไม่แสดงในเมนูจริง ๆ แต่จะถูกเรียกใช้ผ่านทาง URL เท่านั้นดูเพิ่ม