SlideShare a Scribd company logo
drupal-6.9.tar.gz 1052 KB
CMS +  framework + Community
Getting Involved!
do (drupal_module_development)  or  die(a_noob); /* Btw.. That is the official title of this talk. */
Hooks
Drupal API http://api.drupal.org/
Seek the purpose You got to answer some questions. | a good starting point | What do I want to do?
Answers to be found The end user should be able to do this ___________ .  __________ be done to the end user. All corollaries of #1 and #2 After all..
end user
Lets say we want… This is how  user profile page  should look like to anybody visiting it. Block   displaying currently logged in users “role length” details **  we also want the user to receive ‘n’ number of  automated mail notifications  as he is approaching a particular role expiry. User account page Member Since: 3weeks 2days Has role ‘lucky’: expires in 13 more days Has role ‘geek’: Never expires BLAH.. BLAH… <Username> Role ‘rookie’: expires in 14 days Role ‘content contributor’: expires in 100 days
Some more answers to be found Does the admin need to be bothered? What settings/configurations ought to be exposed to the admin? What is the right place (drupal path) to do this? Okay.. So how should the form(s) look like?
Lets say we want…
Lets say we want…
Can I do just use PnC ? Highly recommended to evaluate if the requirements can be fullfiled by PnC of drupal core + “killer modules” Drupal core Core – Optional modules Cck, Views, Panels et al
Contributions!! Where? How? There are very high chances that what you are looking for has already been developed   http://drupal.org/project/Modules http://drupalmodules.com/module-finder Google -> site:drupal.org/project <search keywords> -cvs
No Luck!!
Time to get hands dirty !!  How?
Make sure to look inside related modules Related  => Modules that do things which are only slightly different or slightly similar to the things that you wound want  your module to do.
Indispensable development help
Indispensable development help Coder Schema Form Builder Devel
Determine the schema Requirement collection starts form  the user . Development should start from  the database . Map the  schema  to all/any mock ups you have prepared.
Schmea mockup role_length rid int rlength int exprid int asg_mail text  exp_mail text role_length_user_ roles rid tinyint uid int asg_time timestamp expmail_sent text
Map schema to everything else in the UI mockups just created
**  we also want the user to receive ‘n’ number of mail notifications as he is approaching a particular role expiry. Check if we have all the data that we need.  * Avoid redundancy. There is a lot of data in tables not created by the module being developed. role_length rid int rlength int exprid int asg_mail text  exp_mail text role_length_user_roles rid tinyint uid int asg_time timestamp expmail_sent text  User account page Member Since: 3weeks 2days Has role ‘lucky’: expires in 13 more days Has role ‘geek’: Never expires BLAH.. BLAH… <Username> Role ‘rookie’: expires in 14 days Role ‘content contributor’: expires in 100 days
Creating .info and .install files Use dependencies only when core functionality of your module depends upon other modules ELSE use module_exists() Schema API ? http://api.drupal.org/api/function/hook_install http://api.drupal.org/api/function/hook_uninstall http://api.drupal.org/api/function/hook_install_schema http://api.drupal.org/api/function/hook_schema
Creating .module file http://api.drupal.org/api/function/hook_help http://api.drupal.org/api/function/hook_menu Form API ? http://api.drupal.org/api/file/form_api_reference.html/6 http://api.drupal.org/api/function/hook_form_alter AHAH !!
Best practices to structure  $form Why are they called “best practices” ?
How to: dynamic forms and  forms that “grow” what is the difference!!??
jQuery To jazz up your forms with tool tips, pop-ins, char count et al. AHAH FAPI + menu callback To ajaxify forms without changing the types of or number of elements in the form. (eg: username availability) AHAH FAPI + menu callback + form rebuilding To asynchronously grow the form. Adding/Removing elements or changing types of elements.
Changing forms asynchronously Initially requests for the form Build the form > Send out the rendered form > Save form state in the cache Acts upon the AHAH element “ AHAH callback” fetches form from the cache > build it using $_POST values > Add/Removes/Modifies elements > Set the cache > Output changes as JSON AHAH grabs the JSON response and does the magic.
Major hooks  http://api.drupal.org/api/function/hook_user Gotcha:  Not implementing the case delete. Especially dangerous when modules own tables have user related data. Just do it in the memory of  node/8 http://api.drupal.org/api/function/hook_cron http://api.drupal.org/api/function/hook_block
Tools we can use… DATABASE API http://api.drupal.org/api/function/drupal_write_records http://api.drupal.org/api/function/user_roles http://api.drupal.org/api/function/format_interval http://api.drupal.org/api/function/user_multiple_role_edit http://api.drupal.org/api/function/user_load http://api.drupal.org/api/function/drupal_mail http://api.drupal.org/api/function/watchdog ~ 2200 more
Ain’t Drupal  beautiful ?! To keep it that way don’t spit out your output, theme it.
Ta-Da!! Lets go to  node/59
http://drupal.org/node/100748 Add code to CVS Create the project on drupal.org Create a release Add a handbook page
May  the force  be with you

More Related Content

PDF
PDF
INTERNSHIP OF SAFARI HOTEL HARGEYSA
PDF
Report_on_Industrial Placement
PPT
upload_test_2
PDF
Industrial Report - Ndlovu Kevin Mehluli
DOCX
Android Based Application Project Report.
PDF
Quiz app (android) Documentation
DOCX
Final Year Project Report
INTERNSHIP OF SAFARI HOTEL HARGEYSA
Report_on_Industrial Placement
upload_test_2
Industrial Report - Ndlovu Kevin Mehluli
Android Based Application Project Report.
Quiz app (android) Documentation
Final Year Project Report

What's hot (20)

PDF
Web Development on Web Project Report
PDF
online quiz application project presentation
PDF
47533870 final-project-report
DOCX
Computer Science Internship Report Leena AI
PDF
Report on web development
PDF
Android College Application Project Report
DOCX
Web Vulnerability Scanner project Report
DOCX
Feedback System in PHP
DOC
Android technical quiz app
DOCX
Virtual education system
PDF
Online Examination System For Android AAD Report Akshay Kalapgar
DOCX
VTU final year project report
DOC
Campus news feed
DOCX
Project report on blogs
PDF
Project report - Web Browser in Java by Devansh Koolwal
DOCX
2ND REPORT
PDF
digiinfo website project report
PDF
Complete-Mini-Project-Report
PDF
Project Proposal: Bengali Braille to Text Translation
DOCX
Mobile/Web App Development Project Report
Web Development on Web Project Report
online quiz application project presentation
47533870 final-project-report
Computer Science Internship Report Leena AI
Report on web development
Android College Application Project Report
Web Vulnerability Scanner project Report
Feedback System in PHP
Android technical quiz app
Virtual education system
Online Examination System For Android AAD Report Akshay Kalapgar
VTU final year project report
Campus news feed
Project report on blogs
Project report - Web Browser in Java by Devansh Koolwal
2ND REPORT
digiinfo website project report
Complete-Mini-Project-Report
Project Proposal: Bengali Braille to Text Translation
Mobile/Web App Development Project Report
Ad

Viewers also liked (20)

PPT
Creating Custom Drupal Modules
PDF
Drupal as a Programmer-Friendly CMS at ConFoo
PPTX
Radiation understanding by Muhammad Fahad Ansari 12IEEM14
PDF
PPS
Tour 1997 Europe
PDF
Super Bowl Xlii Champion New York Giants And Amber Alert+Safety Centers+Team ...
PDF
Diario Correo Perù Nota De Prensa Banco de Cordon Teracell PáGina Completa
PDF
Incentive Events
PPT
Libro De Consejos
PPT
El Libro De Consejos Para Profesionales
PDF
Jacob Collage
PPS
Cumple Tio Mario
PDF
52' 2006 sea ray 52 sedan bridge yacht for sale neff yacht sales
PDF
46' 2006 azimut 46 e yacht for sale neff yacht sales
PPT
Work Presentation Sm
PDF
Tamildic6
PDF
Functional Assessment Cont
PPT
Raport Toaleta2012
PDF
Www.Naturalhealingcollege.Com_NHC_Free_Catalog
Creating Custom Drupal Modules
Drupal as a Programmer-Friendly CMS at ConFoo
Radiation understanding by Muhammad Fahad Ansari 12IEEM14
Tour 1997 Europe
Super Bowl Xlii Champion New York Giants And Amber Alert+Safety Centers+Team ...
Diario Correo Perù Nota De Prensa Banco de Cordon Teracell PáGina Completa
Incentive Events
Libro De Consejos
El Libro De Consejos Para Profesionales
Jacob Collage
Cumple Tio Mario
52' 2006 sea ray 52 sedan bridge yacht for sale neff yacht sales
46' 2006 azimut 46 e yacht for sale neff yacht sales
Work Presentation Sm
Tamildic6
Functional Assessment Cont
Raport Toaleta2012
Www.Naturalhealingcollege.Com_NHC_Free_Catalog
Ad

Similar to Advanced Module development (20)

PPT
Drupal Module Development
PPTX
Drupal module development
DOCX
Drupal module development training delhi
PDF
13th Sep, Drupal 7 advanced training by TCS
KEY
PPT
Introduction to Module Development (Drupal 7)
ODP
Custom module and theme development in Drupal7
ODP
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
PDF
Intro to Drupal Module Developement
PDF
Domas monkus drupal module development
PDF
Drupal 8: A story of growing up and getting off the island
PPT
Drupal Install Profiles
PPTX
Drupal Camp Porto - Developing with Drupal: First Steps
KEY
Modules Building Presentation
ODP
Drupal development
PPT
Module development
PDF
Advanced moduledevelopment d6_slideshare
PPT
How to? Drupal developer toolkit. Dennis Povshedny.
PPTX
Drupal online training - GoLogica
PPT
Drupal 6 in a nutshell
Drupal Module Development
Drupal module development
Drupal module development training delhi
13th Sep, Drupal 7 advanced training by TCS
Introduction to Module Development (Drupal 7)
Custom module and theme development in Drupal7
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Intro to Drupal Module Developement
Domas monkus drupal module development
Drupal 8: A story of growing up and getting off the island
Drupal Install Profiles
Drupal Camp Porto - Developing with Drupal: First Steps
Modules Building Presentation
Drupal development
Module development
Advanced moduledevelopment d6_slideshare
How to? Drupal developer toolkit. Dennis Povshedny.
Drupal online training - GoLogica
Drupal 6 in a nutshell

Recently uploaded (20)

PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Empathic Computing: Creating Shared Understanding
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Electronic commerce courselecture one. Pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
MIND Revenue Release Quarter 2 2025 Press Release
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
sap open course for s4hana steps from ECC to s4
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Empathic Computing: Creating Shared Understanding
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
MYSQL Presentation for SQL database connectivity
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
“AI and Expert System Decision Support & Business Intelligence Systems”
Big Data Technologies - Introduction.pptx
Understanding_Digital_Forensics_Presentation.pptx
Spectral efficient network and resource selection model in 5G networks
Electronic commerce courselecture one. Pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?

Advanced Module development

  • 2. CMS + framework + Community
  • 4. do (drupal_module_development) or die(a_noob); /* Btw.. That is the official title of this talk. */
  • 7. Seek the purpose You got to answer some questions. | a good starting point | What do I want to do?
  • 8. Answers to be found The end user should be able to do this ___________ . __________ be done to the end user. All corollaries of #1 and #2 After all..
  • 10. Lets say we want… This is how user profile page should look like to anybody visiting it. Block displaying currently logged in users “role length” details ** we also want the user to receive ‘n’ number of automated mail notifications as he is approaching a particular role expiry. User account page Member Since: 3weeks 2days Has role ‘lucky’: expires in 13 more days Has role ‘geek’: Never expires BLAH.. BLAH… <Username> Role ‘rookie’: expires in 14 days Role ‘content contributor’: expires in 100 days
  • 11. Some more answers to be found Does the admin need to be bothered? What settings/configurations ought to be exposed to the admin? What is the right place (drupal path) to do this? Okay.. So how should the form(s) look like?
  • 12. Lets say we want…
  • 13. Lets say we want…
  • 14. Can I do just use PnC ? Highly recommended to evaluate if the requirements can be fullfiled by PnC of drupal core + “killer modules” Drupal core Core – Optional modules Cck, Views, Panels et al
  • 15. Contributions!! Where? How? There are very high chances that what you are looking for has already been developed  http://drupal.org/project/Modules http://drupalmodules.com/module-finder Google -> site:drupal.org/project <search keywords> -cvs
  • 17. Time to get hands dirty !!  How?
  • 18. Make sure to look inside related modules Related => Modules that do things which are only slightly different or slightly similar to the things that you wound want your module to do.
  • 20. Indispensable development help Coder Schema Form Builder Devel
  • 21. Determine the schema Requirement collection starts form the user . Development should start from the database . Map the schema to all/any mock ups you have prepared.
  • 22. Schmea mockup role_length rid int rlength int exprid int asg_mail text exp_mail text role_length_user_ roles rid tinyint uid int asg_time timestamp expmail_sent text
  • 23. Map schema to everything else in the UI mockups just created
  • 24. ** we also want the user to receive ‘n’ number of mail notifications as he is approaching a particular role expiry. Check if we have all the data that we need. * Avoid redundancy. There is a lot of data in tables not created by the module being developed. role_length rid int rlength int exprid int asg_mail text exp_mail text role_length_user_roles rid tinyint uid int asg_time timestamp expmail_sent text User account page Member Since: 3weeks 2days Has role ‘lucky’: expires in 13 more days Has role ‘geek’: Never expires BLAH.. BLAH… <Username> Role ‘rookie’: expires in 14 days Role ‘content contributor’: expires in 100 days
  • 25. Creating .info and .install files Use dependencies only when core functionality of your module depends upon other modules ELSE use module_exists() Schema API ? http://api.drupal.org/api/function/hook_install http://api.drupal.org/api/function/hook_uninstall http://api.drupal.org/api/function/hook_install_schema http://api.drupal.org/api/function/hook_schema
  • 26. Creating .module file http://api.drupal.org/api/function/hook_help http://api.drupal.org/api/function/hook_menu Form API ? http://api.drupal.org/api/file/form_api_reference.html/6 http://api.drupal.org/api/function/hook_form_alter AHAH !!
  • 27. Best practices to structure $form Why are they called “best practices” ?
  • 28. How to: dynamic forms and forms that “grow” what is the difference!!??
  • 29. jQuery To jazz up your forms with tool tips, pop-ins, char count et al. AHAH FAPI + menu callback To ajaxify forms without changing the types of or number of elements in the form. (eg: username availability) AHAH FAPI + menu callback + form rebuilding To asynchronously grow the form. Adding/Removing elements or changing types of elements.
  • 30. Changing forms asynchronously Initially requests for the form Build the form > Send out the rendered form > Save form state in the cache Acts upon the AHAH element “ AHAH callback” fetches form from the cache > build it using $_POST values > Add/Removes/Modifies elements > Set the cache > Output changes as JSON AHAH grabs the JSON response and does the magic.
  • 31. Major hooks http://api.drupal.org/api/function/hook_user Gotcha: Not implementing the case delete. Especially dangerous when modules own tables have user related data. Just do it in the memory of node/8 http://api.drupal.org/api/function/hook_cron http://api.drupal.org/api/function/hook_block
  • 32. Tools we can use… DATABASE API http://api.drupal.org/api/function/drupal_write_records http://api.drupal.org/api/function/user_roles http://api.drupal.org/api/function/format_interval http://api.drupal.org/api/function/user_multiple_role_edit http://api.drupal.org/api/function/user_load http://api.drupal.org/api/function/drupal_mail http://api.drupal.org/api/function/watchdog ~ 2200 more
  • 33. Ain’t Drupal beautiful ?! To keep it that way don’t spit out your output, theme it.
  • 34. Ta-Da!! Lets go to node/59
  • 35. http://drupal.org/node/100748 Add code to CVS Create the project on drupal.org Create a release Add a handbook page
  • 36. May the force be with you