Taking Your Module from Drupal 6 to Drupal 7 <ul><li>Tobby Hagler, Phase2 Technology </li></ul>
Overview <ul><li>How does this affect your work as a developer </li></ul><ul><li>Biggest module changes from D6 to D7 </li...
How this affects your work as a developer <ul><li>State of documentation </li></ul><ul><li>Where did this hook go? </li></...
State of documentation <ul><li>Converting 6.x modules to 7.x – drupal.org/update/modules/6/7 </li></ul><ul><ul><li>Convert...
Where did this hook or function go? <ul><li>Some hooks have been broken out into more specific hooks with specific functio...
Not my module, and there's no 7.x version <ul><li>Check for a 7.x branch in git </li></ul><ul><li>Module maintainers welco...
Biggest module changes from D6 to D7 <ul><li>Module structure </li></ul><ul><li>Core hook changes </li></ul><ul><li>Contri...
Module structure changes <ul><ul><li>.info file specifies core = 7.x </li></ul></ul><ul><ul><li>.info files specify all lo...
Hook Changes: hook_nodeapi has become many hooks <ul><li>hook_nodeapi  basically  becomes hook_node_$op </li></ul><ul><li>...
Hook Changes: hook_user has also become many hooks <ul><li>hook_user  basically  becomes hook_user_$op </li></ul><ul><li>h...
Hook Changes: hook_block has also become many hooks <ul><li>hook_block_info </li></ul><ul><li>hook_block_configure </li></...
Hook Changes: Other important hooks have changed <ul><li>hook_perm -> hook_permission, which also allows for more user-fri...
Hook Changes: Other important hooks have changed <ul><li>hook_perm becomes hook_permission </li></ul><ul><li>return array ...
Hook Changes: Other important hooks have changed <ul><li>hook_form_alter can be used for node forms now, cleaning up poten...
Incorporated into Drupal Core <ul><li>CCK is now Field API </li></ul><ul><li>Tokens </li></ul><ul><li>Imagecache became Im...
CCK is now Field API <ul><li>Not just for nodes </li></ul><ul><li>Can be used on any object that is “fieldable” like users...
Steps to upgrade <ul><li>Set up an instance of Drupal 7 </li></ul><ul><li>Run Coder Review first </li></ul><ul><li>Try Cod...
Using Coder Review <ul><li>Fresh install of Drupal 6.x </li></ul><ul><li>Enable Coder –  drupal.org/project/coder </li></u...
Coder Review recommendations
Set up Coder Upgrade <ul><li>Fresh install of Drupal 7.x </li></ul><ul><li>Enable Coder Upgrade, other dependencies –  dru...
Coder Upgrade caveats <ul><li>Coder 7.x-1.0-beta6 </li></ul><ul><li>Libraries 7.x-2.x-dev </li></ul><ul><li>Grammar Parser...
Run Coder Upgrade
After Coder Upgrade <ul><li>Install your upgraded module </li></ul><ul><li>Read through the code to reacquaint yourself </...
Run Coder Review
Upgrade by hand? <ul><li>Update hooks </li></ul><ul><li>Update queries </li></ul><ul><li>Update core=7.x and see what happ...
Potential Complications <ul><li>Use of libraries included into the module </li></ul><ul><li>Non-standard behaviors such as...
Questions?
Contact <ul><li>thagler@phase2technology  </li></ul><ul><li>@phase2tech </li></ul><ul><li>703-548-6050 </li></ul><ul><li>d...
Upcoming SlideShare
Loading in...5
×

Taking your module from Drupal 6 to Drupal 7

4,372

Published on

Learn how to take your module from D6 to D7 with this presentation from Senior Developer Tobby Hagler. This talk was given at CapitalCamp in Washington, DC.

Published in: Technology, Art & Photos
1 Comment
3 Likes
Statistics
Notes
  • I Got The Full File, I Just Wanna Share to You Guyszz.. It's Working You Can The Download The Full File + Instructions Here ://http://gg.gg/setupexe
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
4,372
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

Taking your module from Drupal 6 to Drupal 7

  1. 1. Taking Your Module from Drupal 6 to Drupal 7 <ul><li>Tobby Hagler, Phase2 Technology </li></ul>
  2. 2. Overview <ul><li>How does this affect your work as a developer </li></ul><ul><li>Biggest module changes from D6 to D7 </li></ul><ul><li>Steps to upgrade </li></ul><ul><li>Potential Complications </li></ul>
  3. 3. How this affects your work as a developer <ul><li>State of documentation </li></ul><ul><li>Where did this hook go? </li></ul><ul><li>Not my module </li></ul>
  4. 4. State of documentation <ul><li>Converting 6.x modules to 7.x – drupal.org/update/modules/6/7 </li></ul><ul><ul><li>Converting 6.x modules to 7.x: Categorical – drupal.org/node/394070 (incomplete) </li></ul></ul><ul><ul><li>API Documentation – api.drupal.org </li></ul></ul>
  5. 5. Where did this hook or function go? <ul><li>Some hooks have been broken out into more specific hooks with specific function parameters </li></ul><ul><li>Some have simply changed names to something more meaningful </li></ul>
  6. 6. Not my module, and there's no 7.x version <ul><li>Check for a 7.x branch in git </li></ul><ul><li>Module maintainers welcome patches – even 7.x upgrade patches </li></ul><ul><li>Check issue queues for 7x patches that may not have been committed yet </li></ul>
  7. 7. Biggest module changes from D6 to D7 <ul><li>Module structure </li></ul><ul><li>Core hook changes </li></ul><ul><li>Contrib modules incorporated into Drupal Core </li></ul><ul><li>Field API </li></ul><ul><li>Custom database tables or entities ? </li></ul><ul><li>Database API </li></ul>
  8. 8. Module structure changes <ul><ul><li>.info file specifies core = 7.x </li></ul></ul><ul><ul><li>.info files specify all loadable code files </li></ul></ul><ul><ul><li>.info files can set configurations </li></ul></ul><ul><ul><li>Dependencies is now an array and allows for versions ( dependencies[] = views (>3.0) ) </li></ul></ul>
  9. 9. Hook Changes: hook_nodeapi has become many hooks <ul><li>hook_nodeapi basically becomes hook_node_$op </li></ul><ul><li>hook_node_load( $nodes, $types ) </li></ul><ul><li>hook_node_view( $node, $view_mode, $langcode ) </li></ul><ul><li>hook_node_insert( $node ) </li></ul><ul><li>11 hooks in total </li></ul>
  10. 10. Hook Changes: hook_user has also become many hooks <ul><li>hook_user basically becomes hook_user_$op </li></ul><ul><li>hook_user_load( $users ) </li></ul><ul><li>hook_user_view( $account, $view_mode, $langcode ) </li></ul><ul><li>hook_user_update( &$edit, $account, $category ) </li></ul><ul><li>8 hooks in total </li></ul>
  11. 11. Hook Changes: hook_block has also become many hooks <ul><li>hook_block_info </li></ul><ul><li>hook_block_configure </li></ul><ul><li>hook_block_save </li></ul><ul><li>hook_block_view </li></ul>
  12. 12. Hook Changes: Other important hooks have changed <ul><li>hook_perm -> hook_permission, which also allows for more user-friendly output </li></ul><ul><li>hook_form_alter can be used for node forms now, cleaning up potentially nasty nodeapi hacks </li></ul>
  13. 13. Hook Changes: Other important hooks have changed <ul><li>hook_perm becomes hook_permission </li></ul><ul><li>return array ('some permission' => </li></ul><ul><li>array ( </li></ul><ul><li>'title' => t ('Better Permission Title'), </li></ul><ul><li>'description' => t ('Helpful, descriptive text.'), </li></ul><ul><li>), </li></ul><ul><li>); </li></ul>
  14. 14. Hook Changes: Other important hooks have changed <ul><li>hook_form_alter can be used for node forms now, cleaning up potentially nasty nodeapi hacks. </li></ul>
  15. 15. Incorporated into Drupal Core <ul><li>CCK is now Field API </li></ul><ul><li>Tokens </li></ul><ul><li>Imagecache became Image Styles </li></ul>
  16. 16. CCK is now Field API <ul><li>Not just for nodes </li></ul><ul><li>Can be used on any object that is “fieldable” like users and comments </li></ul><ul><li>Many of the custom CCK hooks have been replaced </li></ul><ul><li>Must Read: Updating CCK Field Modules from D6 to D7 – http://drupal.org/node/728792 </li></ul>
  17. 17. Steps to upgrade <ul><li>Set up an instance of Drupal 7 </li></ul><ul><li>Run Coder Review first </li></ul><ul><li>Try Coder Upgrade module </li></ul><ul><li>Manual upgrade </li></ul><ul><li>Creating and providing patches </li></ul>
  18. 18. Using Coder Review <ul><li>Fresh install of Drupal 6.x </li></ul><ul><li>Enable Coder – drupal.org/project/coder </li></ul><ul><li>Make sure your module is installed (does not need to be enabled) </li></ul><ul><li>Select your module and review recommendations </li></ul>
  19. 19. Coder Review recommendations
  20. 20. Set up Coder Upgrade <ul><li>Fresh install of Drupal 7.x </li></ul><ul><li>Enable Coder Upgrade, other dependencies – drupal.org /project/ coder </li></ul><ul><li>For PHP 5.2, uncheck ‘Use separate process’ </li></ul><ul><li>Place a copy of the 6.x version of your module in files/coder_upgrade/old ( permissions! ) </li></ul>
  21. 21. Coder Upgrade caveats <ul><li>Coder 7.x-1.0-beta6 </li></ul><ul><li>Libraries 7.x-2.x-dev </li></ul><ul><li>Grammar Parser Library 7.x-1.x-dev </li></ul><ul><li>Grammar Parser 7.x-1.x-dev </li></ul><ul><li>Grammar Parser goes in sites/all/libraries , not sites/all/modules </li></ul>
  22. 22. Run Coder Upgrade
  23. 23. After Coder Upgrade <ul><li>Install your upgraded module </li></ul><ul><li>Read through the code to reacquaint yourself </li></ul><ul><li>Run Coder Review, using the ‘Converting 6.x modules to 7.x’ option </li></ul><ul><li>Test, test, test </li></ul><ul><li>Submit patch to project’s issue queue? </li></ul>
  24. 24. Run Coder Review
  25. 25. Upgrade by hand? <ul><li>Update hooks </li></ul><ul><li>Update queries </li></ul><ul><li>Update core=7.x and see what happens </li></ul>
  26. 26. Potential Complications <ul><li>Use of libraries included into the module </li></ul><ul><li>Non-standard behaviors such as connecting to other databases </li></ul><ul><li>Code is too custom to be upgraded </li></ul><ul><li>Dependencies on modules that are not 7.x or deprecated </li></ul>
  27. 27. Questions?
  28. 28. Contact <ul><li>thagler@phase2technology  </li></ul><ul><li>@phase2tech </li></ul><ul><li>703-548-6050 </li></ul><ul><li>d.o: tobby </li></ul><ul><li>Slides: agileapproach.com </li></ul>

×