1) Edit .info file
Add the following line:
core = 6.x
DRUPAL_CORE_COMPATIBILITY defined in modules/system/system.moduleChange
dependencies = module_a module_b module_c
to
dependencies[] = module_a
dependencies[] = module_b
dependencies[] = module_c
2) Update hook_menu()
3) Update to new Form API
Includes the hooks hook_elements(), hook_forms()
any calls to the functions drupal_get_form(), drupal_retrieve_form()
and any use of the array keys #submit, #validate, #process, #multi_step, #base, #pre_render
4) hook signature changes:
function mymodule_form_alter($form_id, &$form)
becomes
function mymodule_form_alter(&$form, $form_state, $form_id)
function mymodule_help($section) { switch ($section) {
becomesfunction mymodule_help($path, $arg) { switch ($path) {
5) Other substitutions
url($path, $query, $fragment, $absolute)
becomesurl($path, array('query' => $query, 'fragment' => $fragment, 'absolute' => $absolute));If you know for sure that your$pathdoes not need to be looked up in the URL alias table, you can also add'alias' => TRUEto boost performance$attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = FALSE)l($text, $path, $attributes, $query, $fragment, $absolute, $html)
becomesl($text, $path, array('attributes' => $attributes, 'query' => $query, 'fragment' => $fragment, 'absolute' => $absolute, 'html' => $html));If you know for sure that your$pathdoes not need to be looked up in the URL alias table, you can also add'alias' => TRUEto boost performance
6) No longer supported:
db_num_rows()is gone. Count the rows yourself while iterating through the result set, or run aCOUNT(*)SQL query.
If your module defines a custom node
- hook_access() $account parameter
- Add $account as the third parameter to hook_access()
- Get rid of global $user references and replace them with $account
- Add $account as a second parameter to all calls to user_access()
update hook_form() to use Drupal 6 form api
- Replace your
hook_submit()with extra code inhook_form()
If your module defines custom form elements
Move theme_elementname to elementname.tpl.php
Create a hook_theme()
Create a hook_theme entry for each custom form element, and load admin/build/modules to get drupal to call your new hook_theme()
- (Optional) Add arguments to your #process function.
The
#processfunction signature is nowprocess($element, $edit, $form_state, $complete_form)
If your module has its own database tables
- (Optional) Switch to the Schema API.
If your module defines theme functions / themeable hooks
Create a hook_theme() function which tells Drupal about your theme functions, as they are no longer discovered automatically.
Optional Changes
A) (Optional) Clean up detection of which menu handler is active
Code which calls arg() to determine the current menu handler can be replaced with a call to menu_get_item().
For example:
if (arg(0) == 'node' && is_numeric(arg(1)) && ($node = node_load(arg(1)))){
}
can sometimes be replaced with something along the lines of:$menu_item = menu_get_item();
if ($menu_item['path'] == 'node/%' && ($node = menu_get_object())){
} (runs on node/1234 but not node/1234/edit)
or:
if ($node = menu_get_object()){
}
(runs on all node pages where the node id is arg(1), even if arg(0) is not 'node')
