New online tools for porting your module to D7
Three quick points on this Friday.
First, Drupal 7 is almost "officially" here. Although not officially released, it is in production use on several large sites, among the most notable being Examiner.com. That fact is a tribute to the automated testing system in place for core development.
Second, kudos to those contributed module maintainers who have lived up to their D7CX pledges and have their modules ready for D7.
Third, for those who need to port a module from D6 to D7, take a look at these new online conversion tools. You can:
- Reformat your code to match Drupal coding standards
- Apply conversion routines to your code
- Review the converted code for compliance with the remaining D7 APIs
- Convert a SQL expression to the Database API syntax used by Drupal 7
The code reformatting is an automatic by-product of using the Grammar Parser to rewrite your code. The code conversions are handled by Coder Upgrade while the post-conversion reviews are made by Coder Review, both part of the Coder project. You have the choice of uploading an entire module(s), or copying and pasting a single code file or a code snippet.
It's simple. Upload your D6 module code. Download your converted module code, a patch file, and the output from Coder Review applied to the converted code.
The SQL conversion tool is the SQL parser module. Copy and paste a SQL expression, click a button, and receive a D7 database object expression.
If you try out the new tools, don't forget to provide some feedback.
Upgrading theme() calls with Coder Upgrade
A lot of effort has been poured into the upgrade routines for Coder Upgrade as evidenced by the green check marks on this page. (A side note: so far, duellj is the only person to show up for the upgrade barn raising and much thanks to Jon is due. If you are up for a challenge, help is still welcomed and needed to write and/or test routines.)
An interesting example of an upgrade routine is the theme() function call change. This upgrade involves "array-itizing" the variable parameters. For example, this:
<?php
theme('user_list', $users, $title);
?>
becomes in D7:
<?php
theme('user_list', array('users' => $users, 'title' => $title));
?>
The twist involves finding the keys for the associative array of variables.
Sparing the details, Coder Upgrade will insert the proper keys for any theme defined in D7 core files (includes and modules directories) as well as themes defined by the module being upgraded.
If there is a particular change from D6 to D7 that is important to contributed modules you maintain or use, consider giving a few hours of your time to help write and/or test an upgrade routine. Together, we can have our contributed modules ready for Drupal 7 when it is released.