SlideShare a Scribd company logo
Module Development



      Ipsita Mishra
    Siva Kumar Epari


    http://melity.com
About Us

●Ipsita Mishra
✔4 years of Drupal experience

✔Tech lead

✔Webadmin & Core member of Drupal Hyderabad



●Siva Kumar Epari
✔2 years of Drupal experience

✔Drupal Developer

✔Webadmin & Core member of Drupal Hyderabad
Types of Modules



  Core Modules

 Contrib Modules

 Custom Module
Core Modules

These are the modules that ships with a Standard
Drupal Release. There are Core Optional and
Core Required modules.

For example:
Node
User
Block
System
Filter
Contrib Modules


Over 5800 (as of July 20, 2010) free community-
contributed modules, known as contrib modules,
are available to alter and extend Drupal's core
capabilities and add new features or customize
Drupal's behavior and appearance.
Popular Contrib Modules




These statistics are incomplete; only Drupal websites using
   the Update Status module are included in the data.
Custom Module


A Custom module is one which is local to your
Drupal Project. It's not yet contributed to the
contrib repository.
Custom Module(When to write)

You need to answer few questions before writing a
Custom Module
1. What do you want to achieve by this custom module?
2. Did you search the Contrib Repository to see if a
module is already available for that feature?
3. Have you enabled all possible Configurations of the
Core & Contrib module to check if they offer you the
feature you require?

If your answer is, “Yes, I have done enough research and
 am sure I have to write the code now”, then go ahead ....
Custom Module(Why to write)


I have 2 reasons to write a Custom module

1. I need a new feature which is not yet available in
Drupal, and probably can be contributed as a Contrib
Module.

2. I don't want to keep adding additional modules to my
site for small tweaks, which I can manage in only one
custom module for my website. Don't be too much
dependent on Contribs.
A simple module directory
        structure



                 modulename.info


    modulename


             modulename.module
new.info

                    ; $Id$

                name = Module name
                description = “Module description”
modulename.info core = Drupal version (e.g.: 5.x, 6.x)
                package = Package name



                    ; $Id$

                    name = Text Captcha
                    description = “Text Captcha”
     new.info       core = 6.x
                    package = Osidays
new.module
             <?php

             // $Id$

             function new_form_alter(&$form, &$form_state, $formid){
               if(substr($formid, -9) == 'node_form'){
                  $form['captcha'] = array(
                     '#type' => 'textfield',
                     '#title' => 'Captcha Question : What is 5 + 3?',
                  );
                  $form['#validate'][] = '_new_validate';
                  $form['#submit'][] = '_new_submit';
new.module     }
             }

             function _new_validate($form, &$form_state){
               if($form_state['values']['captcha'] != '8'){
                    form_set_error('captcha', 'Your Captcha answer is wrong!
             So you are not a human or you don't know counting :D');
               }
             }

             function _new_submit($form, &$form_state){
               drupal_set_message('You are a human!');
             }
Download examples module from
http://drupal.org/project/examples
http://drupal.org/project/examples
node_example module
hook_node_info()
hook_access()
hook_perm()
hook_perm() Output
http://localhost/drupal-6.19/admin/user/permissions
hook_form()
hook_form() Contd...
hook_validate()
hook_insert()
hook_schema()
hook_install() hook_uninstall()
hook_update()




Preventing SQL injection is easy; db_query provides a way to use
parametrized queries. Drupal's database functions replace the sprintf-like
placeholders with the properly escaped arguments in order of appearance:
%d - integers
%f - floats
%s - strings, enclose in single quotes
%b - binary data, do not enclose in single quotes
hook_nodeapi()
hook_delete()
hook_load()
hook_view()
hook_theme()
Theme function
Menu System
hook_menu()
Menu Item Types
"type": A bitmask of flags describing properties of the menu
item. Many shortcut bitmasks are provided as constants in
menu.inc:

  * MENU_NORMAL_ITEM: Normal menu items show up in
the menu tree and can be moved/hidden by the
administrator.
  * MENU_CALLBACK: Callbacks simply register a path so
that the correct function is fired when the URL is accessed.
  * MENU_SUGGESTED_ITEM: Modules may "suggest"
menu items that the administrator may enable.
  * MENU_LOCAL_TASK: Local tasks are rendered as tabs
by default.
  * MENU_DEFAULT_LOCAL_TASK: Every set of local tasks
should provide one "default" task, that links to the same
path as its parent when clicked.

If the "type" key is omitted, MENU_NORMAL_ITEM is
assumed.
hook_menu_alter()
Drupal Blocks
hook_block()
A Block represents some auxiliary content along
with the primary content of the page.
The output is themed
  comment.module
Parameters
hook_block($op = 'list', $delta = 0, $edit = array())
Operation: list
Operation: configure
Operation: save
Operation: view
Developer's Tools


●   Drush
●   Devel and Devel Themer
●   Coder
●   Admin Menu
DRUpal SHell

●   drush dl modulename/themename
●   drush en modulename/themename
●   drush dis modulename/themename
●   drush pm-uninstall modulename/themename
●   drush cc


Resource:
http://drupal.org/files/drush-cheat-sheet.pdf
Devel

● Devel: Helper functions for Drupal developers.
● Generate content: Accelerate development of

your site or module by quickly generating nodes,
comments, terms, users, and more.
● Node Access Summary: View the node access

entries for the node(s) that are shown on a page.
Devel Themer
Coder




This module helps in Code Review
A Sample Analysis by Coder
Resources
http://api.drupal.org




 IRC Channel
 #drupal
 #drupal-support
 #drupal-hyderabad
Drupal Module Development
Thank You
@IpsitaMishra
@siva_epari

More Related Content

What's hot (20)

PDF
Working with the django admin
flywindy
 
PDF
Drupal 8: Theming
drubb
 
PDF
backend
tutorialsruby
 
PDF
Using Renderless Components in Vue.js during your software development.
tothepointIT
 
PPTX
Let's write secure Drupal code! - Drupal Camp Poland 2019
Balázs Tatár
 
PPT
PHP and MySQL
webhostingguy
 
PDF
Login and Registration form using oop in php
herat university
 
PPT
Starting with PHP and Web devepolment
Rajib Ahmed
 
KEY
Django Admin: Widgetry & Witchery
Pamela Fox
 
PDF
Extending the WordPress REST API - Josh Pollock
Caldera Labs
 
PPTX
Working with WP_Query in WordPress
topher1kenobe
 
PPTX
Let's write secure drupal code! - Drupal Camp Pannonia 2019
Balázs Tatár
 
PDF
Getting to The Loop - London Wordpress Meetup July 28th
Chris Adams
 
KEY
Geek Moot '09 -- Smarty 101
Ted Kulp
 
PPTX
System performance tuning
Menandro Oba
 
ODP
Intro to drupal module internals asheville
cgmonroe
 
PDF
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
tutorialsruby
 
PPTX
Php session 3 Important topics
mohamedsaad24
 
PPT
Php MySql For Beginners
Priti Solanki
 
PDF
Views Style Plugins
mwrather
 
Working with the django admin
flywindy
 
Drupal 8: Theming
drubb
 
backend
tutorialsruby
 
Using Renderless Components in Vue.js during your software development.
tothepointIT
 
Let's write secure Drupal code! - Drupal Camp Poland 2019
Balázs Tatár
 
PHP and MySQL
webhostingguy
 
Login and Registration form using oop in php
herat university
 
Starting with PHP and Web devepolment
Rajib Ahmed
 
Django Admin: Widgetry & Witchery
Pamela Fox
 
Extending the WordPress REST API - Josh Pollock
Caldera Labs
 
Working with WP_Query in WordPress
topher1kenobe
 
Let's write secure drupal code! - Drupal Camp Pannonia 2019
Balázs Tatár
 
Getting to The Loop - London Wordpress Meetup July 28th
Chris Adams
 
Geek Moot '09 -- Smarty 101
Ted Kulp
 
System performance tuning
Menandro Oba
 
Intro to drupal module internals asheville
cgmonroe
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
tutorialsruby
 
Php session 3 Important topics
mohamedsaad24
 
Php MySql For Beginners
Priti Solanki
 
Views Style Plugins
mwrather
 

Viewers also liked (20)

PDF
Drupal 7
guest31ca73
 
PDF
Drupal for Publishers: How to Build a Better Newsroom CMS
Acquia
 
PDF
Drupal Continuous Integration (European Drupal Days 2015)
Eugenio Minardi
 
PDF
Best Practice Checklist for Building a Drupal Website
Acquia
 
PPTX
Best practices for Continuous Deployment with Drupal - DrupalCon Latin Améric...
Taller Negócio Digitais
 
PDF
FLTK Summer Course - Part VIII - Eighth Impact
Michel Alves
 
PDF
FLTK Summer Course - Part II - Second Impact - Exercises
Michel Alves
 
PDF
FLTK Summer Course - Part VI - Sixth Impact - Exercises
Michel Alves
 
PDF
EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...
Alessandro Molina
 
PDF
Using Git on the Command Line
Brian Richards
 
PDF
Code Refactoring - Live Coding Demo (JavaDay 2014)
Peter Kofler
 
PDF
Git hooks For PHP Developers
Umut IŞIK
 
PDF
TMS - Schedule of Presentations and Reports
Michel Alves
 
PDF
FLTK Summer Course - Part VII - Seventh Impact
Michel Alves
 
PDF
FLTK Summer Course - Part III - Third Impact
Michel Alves
 
PDF
Advanced Git
Sergiu-Ioan Ungur
 
PDF
"Git Hooked!" Using Git hooks to improve your software development process
Polished Geek LLC
 
PDF
Blisstering drupal module development ppt v1.2
Anil Sagar
 
PPT
Introduction to Git Commands and Concepts
Carl Brown
 
PDF
FLTK Summer Course - Part I - First Impact - Exercises
Michel Alves
 
Drupal 7
guest31ca73
 
Drupal for Publishers: How to Build a Better Newsroom CMS
Acquia
 
Drupal Continuous Integration (European Drupal Days 2015)
Eugenio Minardi
 
Best Practice Checklist for Building a Drupal Website
Acquia
 
Best practices for Continuous Deployment with Drupal - DrupalCon Latin Améric...
Taller Negócio Digitais
 
FLTK Summer Course - Part VIII - Eighth Impact
Michel Alves
 
FLTK Summer Course - Part II - Second Impact - Exercises
Michel Alves
 
FLTK Summer Course - Part VI - Sixth Impact - Exercises
Michel Alves
 
EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...
Alessandro Molina
 
Using Git on the Command Line
Brian Richards
 
Code Refactoring - Live Coding Demo (JavaDay 2014)
Peter Kofler
 
Git hooks For PHP Developers
Umut IŞIK
 
TMS - Schedule of Presentations and Reports
Michel Alves
 
FLTK Summer Course - Part VII - Seventh Impact
Michel Alves
 
FLTK Summer Course - Part III - Third Impact
Michel Alves
 
Advanced Git
Sergiu-Ioan Ungur
 
"Git Hooked!" Using Git hooks to improve your software development process
Polished Geek LLC
 
Blisstering drupal module development ppt v1.2
Anil Sagar
 
Introduction to Git Commands and Concepts
Carl Brown
 
FLTK Summer Course - Part I - First Impact - Exercises
Michel Alves
 
Ad

Similar to Drupal Module Development (20)

ODP
Drupal Best Practices
manugoel2003
 
PPTX
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
LEDC 2016
 
PPTX
Migrate yourself. code -> module -> mind
Valentine Matsveiko
 
PDF
D7 theming what's new - London
Marek Sotak
 
PPTX
Drupal Camp Porto - Developing with Drupal: First Steps
Luís Carneiro
 
ZIP
Learning the basics of the Drupal API
Alexandru Badiu
 
PPTX
Debugging in drupal 8
Allie Jones
 
ODP
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Mir Nazim
 
ZIP
What's new in the Drupal 7 API?
Alexandru Badiu
 
PDF
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
camp_drupal_ua
 
PPTX
ONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICES
DrupalCamp Kyiv
 
PDF
Drupal vs WordPress
Walter Ebert
 
PDF
jQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
Darren Mothersele
 
PDF
Drupal 7 Theming - Behind the scenes
ramakesavan
 
PDF
Advanced moduledevelopment d6_slideshare
Opevel
 
PPT
Drupal Javascript for developers
Dream Production AG
 
PDF
Drupal Workshop: Introducción al Backend de Drupal
David (davidjguru) Rodríguez
 
PDF
Drupal tips 'n tricks
John Tsevdos
 
PDF
Drupal Security from Drupalcamp Bratislava
Gábor Hojtsy
 
KEY
Intro To jQuery In Drupal
Matthew Farina
 
Drupal Best Practices
manugoel2003
 
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
LEDC 2016
 
Migrate yourself. code -> module -> mind
Valentine Matsveiko
 
D7 theming what's new - London
Marek Sotak
 
Drupal Camp Porto - Developing with Drupal: First Steps
Luís Carneiro
 
Learning the basics of the Drupal API
Alexandru Badiu
 
Debugging in drupal 8
Allie Jones
 
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Mir Nazim
 
What's new in the Drupal 7 API?
Alexandru Badiu
 
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
camp_drupal_ua
 
ONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICES
DrupalCamp Kyiv
 
Drupal vs WordPress
Walter Ebert
 
jQuery UI Widgets, Drag and Drop, Drupal 7 Javascript
Darren Mothersele
 
Drupal 7 Theming - Behind the scenes
ramakesavan
 
Advanced moduledevelopment d6_slideshare
Opevel
 
Drupal Javascript for developers
Dream Production AG
 
Drupal Workshop: Introducción al Backend de Drupal
David (davidjguru) Rodríguez
 
Drupal tips 'n tricks
John Tsevdos
 
Drupal Security from Drupalcamp Bratislava
Gábor Hojtsy
 
Intro To jQuery In Drupal
Matthew Farina
 
Ad

Recently uploaded (20)

PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 

Drupal Module Development