1) Edit .info file
Add the following line:
core = 6.x
which should match the value of DRUPAL_CORE_COMPATIBILITY defined in modules/system/system.module
Change
dependencies = module_a module_b module_c
to
dependencies[] = module_a
dependencies[] = module_b
dependencies[] = module_c
2) Update hook_menu()
http://drupal.org/node/103114
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
http://drupal.org/node/144132
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) {
becomes
function mymodule_help($path, $arg) { switch ($path) {
5) Other substitutions
url($path, $query, $fragment, $absolute)
becomes
url($path, array('query' => $query, 'fragment' => $fragment, 'absolute' => $absolute));
If you know for sure that your $path does not need to be looked up in the URL alias table, you can also add 'alias' => TRUE to boost performance$attributes = array(), $query = NULL, $fragment = NULL, $absolute = FALSE, $html = FALSE)
l($text, $path, $attributes, $query, $fragment, $absolute, $html)
becomes
l($text, $path, array('attributes' => $attributes, 'query' => $query, 'fragment' => $fragment, 'absolute' => $absolute, 'html' => $html));
If you know for sure that your $path does not need to be looked up in the URL alias table, you can also add 'alias' => TRUE to boost performance
6) No longer supported:
db_num_rows() is gone. Count the rows yourself while iterating through the result set, or run a COUNT(*) 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 in hook_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 #process function signature is now process($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')
This article is very useful ..
ReplyDelete