Drupal Module Development

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    2 Favorites

    Drupal Module Development - Presentation Transcript

    1. CMS + framework + Community
    2. Getting Involved!
    3. do (drupal_module_development) or die(a_noob); /* Btw.. That is the official title of this talk. */
    4. Hooks
    5. Drupal API http://api.drupal.org/
    6. Seek the purpose You got to answer some questions. | a good starting point | What do I want to do?
    7. 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..
    8. end user
    9. 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
    10. 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?
    11. Lets say we want…
    12. Lets say we want…
    13. Try all PnC
      • Highly recommended to evaluate if the requirements can be fulfilled by PnC of drupal core + “killer modules”
      • Drupal core
      • Core – Optional modules
      • Cck, Views, Panels et al
    14. 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
    15. No Luck!!
    16. Time to get hands dirty !!  How?
    17. 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.
    18. Indispensable development help
    19. Indispensable development help Coder Schema Form Builder Devel
    20. 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.
    21. Schema 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
    22. Map schema to everything else in the UI mockups just created
    23. ** 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
    24. 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
    25. 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 !!
    26. Best practices to structure $form Why are they called “best practices” ?
    27. 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.
    28. 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.
    29. 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
    30. 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
    31. Ain’t Drupal beautiful ?! To keep it that way don’t spit out your output, theme it.
    32. 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
    33. May the force be with you
    34. ? Sumeet Pareek aka WikidKaka positivecharge (at) gmail (dot) com http://sumeetpareek.com http://drupal.org/user/301925

    + sumeetpareeksumeetpareek, 9 months ago

    custom

    1533 views, 2 favs, 1 embeds more stats

    How to do custom module development in drupal and c more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1533
      • 1520 on SlideShare
      • 13 from embeds
    • Comments 0
    • Favorites 2
    • Downloads 54
    Most viewed embeds
    • 13 views on http://sumeetpareek.com

    more

    All embeds
    • 13 views on http://sumeetpareek.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories