Table of Contents

Developing for Drupal 1

Contributing to Drupal 2

Types of Contributions 2

Task list 3

Bug reports 3

How to report bugs effectively 3

Feature suggestions 10

Patches 10

Diff and patch 10

Diff on Windows 12

Patching with Cygwin 13

Gnuwin32 diff and patch 14

Patch on Windows 14

Using Cygwin to patch in Windows 15

HOWTO: Set up a test environment to help review patches 16

Creating and submitting patches 18

Tips for reviewing patches 19

General guidelines 19

Reviewing process 20

Authoring a patch review 20

Severity levels of bugs 20

The revision process 21

Criteria for evaluating proposed changes 22

Maintaining a project on drupal.org 22

Downloads and packaging . . . . . . . . . . . . . . 23

Managing releases . . . . . . . . . . . . . . . . 23

Orphaned projects . . . . . . . . . . . . . . . . 23

Tips for contributing to the core . . . . . . . . . . . . . 24

List of maintainers . . . . . . . . . . . . . . . . . 24

Mailing lists . . . . . . . . . . . . . . . . . . . 26

Translations . . . . . . . . . . . . . . . . . . 26

Consulting . . . . . . . . . . . . . . . . . . . 26

CVS commits 27

Infrastructure 27

Mailing of project issues . . . . . . . . . . . . . . . 27

Coding standards . . . . . . . . . . . . . . . . . 28

Drupal Coding Standards . . . . . . . . . . . . . . . 28

Control Structures 28

Function Calls 29

Function Declarations 29

Arrays 229

Comments 330

Including Code 330

PHP Code Tags 30

Header Comment Blocks 331

Using CVS 31

Example URLs 331

Naming Conventions 331

Functions and Methods 331

Constants 332

Global Variables 332

Filenames 332

Doxygen formatting conventions 332

Configuring vim 334

Identation 334

Syntax highlighting 334

Using these settings only with drupal 335

Indenting 335

PHP Code tags 335

SQL naming conventions 336

String concatenations 337

Use of icons 337

Write E_ALL compliant code 337

Introductionary notice 337

E_ALL: a better practice 337

Common coding mistakes and new coding practice 338

1- Use of if (isset($var)) or if (!empty($var)) 338

Testing for error notices 339

Functions 339

Constants 40

Control structures 40

Header comment blocks 40

CVS 42

CVS concepts -42

Using CVS with branches and tags 43

Windows 444

Available Branches 45

Apply for contributions CVS access 45

CVS GUIs and clients 45

Cross-platform CVS clients 45

Eclipse CVS plug-in 45

Checkout Drupal CVS into the Eclipse Workspace 45

Installing Eclipse with PHP Support 46

Checkout Drupal in your Eclipse Workspace 46

CVS front ends for Windows 47

SmartCVS 447

TortoiseCVS 47

WinCVS 48

Adding a new project 48

Checking out a project using WinCVS 49

CVS on Mac OS X 49

CVL: point and click CVS 49

Setting up/step by step CVS 550

Basic CVS with CVL 551

Preparing a project 552

Committing a project 552

Drupal CVS repositories 553

Main repository 553

Contributions repository 554

Promoting a project to be an official release 555

Adding/modifying a file to the CVS repository 556

Adding 556

Modifying 557

Demoting an official release 557

Tracking Drupal source with CVS 557

Example 557

Managing contributions 558

Updating the vendor branch (61

Summary (62

Additional resources (62

Sandbox maintenance rules (62

Commit messages—providing history and credit (63

Give details (63

Provide a link to the drupal.org issue, if available (63

Give credit (63

Additional references . . . . . . . . . . . . . . . . (. 4

Drupal's APIs 65

Forms API (65

Forms API Quickstart Guide (67

Forms API reference . . . . . . . . . . . . . . . . (. 7

Multipage forms with the Forms API . . . . . . . . . . . . (. 7

Why can't I make multipage forms with what I already know? (67

A Fully Working Example (68

Tips and Tricks . . . . . . . . . . . . . . . . . (. 9

#tree and #parents (69

Adding a custom element type & expanding elements 71

Adding and theming additional fields to a node form . . . . . . . 7. 3

Creating an array of form elements . . . . . . . . . . . . 7. 4

Creating fieldsets outside forms with minimal code . . . . . . . . 7. 5

Creating multi-part forms 775

Creating submit buttons with images 78

Easier debugging of forms code 79

Getting a form element without a form 779

Modifying checkboxes to display in multiple columns 880

Module dependency checker 882

The #ref property 884

Writing forms in tables 887

Upgrading to forms API 888

Example module conversion: Project Module 889

Overview 889

Conversion Tips 990

Form Updater 990

Common legacy form errors 991

project_settings: Converting a hook_settings implementation (Easy) ... 992

Overview 992

Original function 993

Form conversion . . . . . . . . . . . . . . . . 9. 4

hook_settings changes in 4.7 995

Default values 996

Converted function 996

Core module before and after examples 998

Standard example: Path Form 998

Before 98

Fieldsets and advanced fields: system_view_general 100

Validation and execution functions: contact_mail_page 113

Theming forms: system_themes 119

Before 119

Advanced themeing: system_user . . . . . . . . . . . . 12.5

Drupal 4.6 vs. Drupal 4.7 Forms API Flowcharts . . . . . . . . . 12.8

Drupal Pre-4.7 Forms API 128

Drupal 4.7 Forms API 1330

Forms API FAQ 1332

How do you use the #validation arguments? 1332

How do you validate a URL, e-mail address or integer value? 1332

is the nodeapi 'validate' op to be used anymore given the validation features of the new api? if so, when? 1333

Form logic 1333

How do you handle multiple submit buttons in a form? Where do you put the

'dispatch logic'? 133

What does #post_process do? 1333

Miscellaneous 1333

How do I add a taxonomy selection to my form? 1333

Why was the #attribute_name convention chosen? 1333

Your own drupaldocs or api.drupal.org site 1334

Module developer's guide 1336

Introduction to Drupal modules 1336

Creating modules - a tutorial 1336

01. Getting started 1337

02. Telling Drupal about your module 1337

03. Telling Drupal who can use your module 1338

04. Declare we have block content 140

05. Generate the block content 141

06. Installing, enabling and testing the module 144

07. Create a module configuration (settings) page 145

08. Generate a page content 148

09. Letting Drupal know about the new function 149

10. Adding a 'more' link and showing all entries 1550

Conclusion 1551

Documenting your code 1551

How to create your own simple node type (from story node) 1551

How to create your own simple node type (from story node) (Drupal 4.7) 1559

Third party applications integration guide 1(69

Session handler issues 169

Sharing a user base 1770

Theme engine integration 1772

Using Javascript and AJAX 1773

Drupal's Javascript tools 1773

drupal.js functions 1773

Testing for appropriate Javascript support 1774

AJAX data exchanges 1774

Working with CSS class names 1774

Element position 1775

Adding events 1775

Tutorial 1: Creating new Javascript widgets 1775

Tutorial 2: Using existing Javascript widgets: autocomplete 1778

Prebuilt autocomplete functions 1779

Building a custom autocomplete function 1779

Tutorial 3: Creating new widgets with AJAX 1880

AJAX solution components 1881

Example: click_info with AJAX 181

1. Marking up content 1881

2. The Javascript 182

Objects and methods 1882

3. The Handler 184

More examples 1886

Additional tools and approaches 1886

Using the APIs available through contributed modules 1886

Views 1886

Actions and Workflows 1886

E-Commerce 1887

Location 1887

Writing .install files 1887

Install instructions 1887

Update instructions 1888

Drupal's menu building mechanism 1888

Drupal's node building mechanism 191

Drupal's page serving mechanism 1995

Updating your modules 202

Converting 3.0 modules to 4.0 2(02

Converting 4.0 modules to 4.1 2(02

Required changes 2(02

Optional changes 2(03

Converting 4.1 modules to 4.2 2(04

Converting 4.2 modules to 4.3 2(05

Creating modules for version 4.3.1 2(06

Getting Started 2(07

Telling Drupal about your module 2(07

Telling Drupal who can use your module 2(08

Announce we have block content 2(09

Generate content for a block 2(09

Installing, enabling and testing the module 213

Create a module configuration (settings) page 214

Adding menu links and creating page content 216

Letting Drupal know about the new function 217

Adding a more link and showing all entries 218

Conclusion 218

How to build up a _help hook 219

How to convert a _system hook 2220

How to convert an _auth_help hook 2221

Converting 4.3 modules to 4.4 2223

Menu system 2223

Theme system 2224

Node system 2225

Filter system 2225

Hook changes 2226

Emitting links 227

Status and error messages 2228

Converting 4.4 modules to 4.5 2228

Menu system 2228

Path changes 229

Node changes 230

Filtering changes 2331

Check_output() changes 231

Filter hook 2331

Filter tips 232

Other changes 233

Converting 4.5 modules to 4.6 233

Block system 233

Search system 234

Module paths 234

Database backend 234

Theme system 2334

Watchdog messages 235

Node markers 235

Control over destination page after form processing 235

Confirmation messages 235

Inter module calls 235

Node queries 236

Text output 236

Converting XML-RPC using modules 237

Converting 4.6 modules to 4.7 239

Overview of Drupal API changes in 4.7 2339

New handling of return values from callbacks 240

node definition changes 240

node_load() changes . . . . . . . . . . . . . . . . . 24.2

node_save() changes . . . . . . . . . . . . . . . . . 24.2

node_list() changes . . . . . . . . . . . . . . . . . 24. 2

Node titles now handled by node modules . . . . . . . . . . . 24. 3

module_get_node_name deprecated 243

format_name() renamed . . . . . . . . . . . . . . . . 24. 4

theme_table() change . . . . . . . . . . . . . . . . 24. 4

check_output() change . . . . . . . . . . . . . . . . 24. 5

XML-RPC changes 2-45

Taxonomy API change . . . . . . . . . . . . . . . . 24. 5

message_access() removed . . . . . . . . . . . . . . . 24.6

Unicode string API 246

conf_url_rewrite() became custom_url_rewrite() . . . . . . . . . . 24.7

node_delete(): moderately used 247

New order of node hooks 248

hook_nodeapi('settings', ...) replaced by form api 248

hook_nodeapi('form x', ...) replaced by form api 249

file_directory variables replaced by functions . . . . . . . . . . . 24. 9

array2object replaced by native PHP type conversion 249

user_load returns FALSE if a user cannot be loaded 2550

MySQL tables are now always UTF-8 encoded 2550

We no longer use the <base> element 2550

hook_onload replaced by addLoadEvent() 2551

hook_search_item replaced by hook_search_page . . . . . . . . . 25. 1

Extreme long comment on http://drupal.org/node/42388 2551

Revisions overhaul 2553

Fields moved from node table to node_revisions table 2553

Making your module revisions aware 2553

Join forces 2554

Reference 2555

Drupal database documentation 2555

'Status' field values for nodes and comments 2555

Module how-to's 2555

How to handle text in a secure fashion 2555

In practice 2557

Writing filters 2558

How to write a node module 2558

How to write automated tests 2558

The basic class structure 2559

The DrupalTestCase features 2559

Implementing hook_simpletest 2(62

Running tests 2(62

Testing core modules and APIs 2(63

Function testing vs. browser testing 2(63

Function-based tests 2663

Browser-based tests 264

Tips 2667

Viewing source during a browser test 2667

How to write database independent code 2667

How to write efficient database JOINs 2668

How to connect to multiple databases within Drupal 2669

How to write themable modules 2770

Drupal enhancement proposals (DEP) 2771

DEPS in progress 2771

Events Improvement 2771

How this project is organized 2772

Who's involved 2772

Areas of improvement 2772

Workflow Proposals 2772

Workflow for event creation, invite, and rsvp 2772

CivicSpace: Workflow event creation, searching, invitation, and rsvp . . . 2774

Next generation event management based on views and the content creation kit . 2774

Use cases and motivation 2774

IRC Meetings 2775

3/6/06 IRC Meeting: Re-Thinking Events in Drupal 2775

Events DEP Stub 2776

Mapping API Generalization 2777

Finished DEPs . . . . . . . . . . . . . . . . . . 27.8

Drupal.org site maintainers 2779

Site maintainer's guide 2881

Unpublishing vs deleting of content 2881

Blocking vs deleting of users 2881

Suggested Workflow 2881

Badly formatted posts 2882

Translator's guide 2883

Programs to use for translation 2883

Issues using poEdit 2884

Plurals Solution #1 2884

Plurals Solution #2 2884

Plurals Solution #3 2885

Setting up XEmacs with po-mode on Windows 2888

Translated Drupal information 2888

Afrikaans 2889

Vir diegene wat betrokke wil raak by die vertaling: 2889

Om 'n fout met die vertaling te rapporteer: 2889

Vir enige ander verwante redes waaroor jy wil kontak: . . . . . . . 28.9

Russian 2889

Spanish 2889

Translation guidelines 2889

Translation of contributed modules 2990

Distributing the translation effort 2990

Status of the translations 2990

Status overview 2991

Checking your translation status 2992

Make a single file from the loose .po files from CVS . . . . . . . . . 29.2

Recycling old translations 2993

Troubleshooting 2993

Some strings do not translate 2993

Weird characters or question marks 2994

Bazaar-NG 295

Installation 295

Installation on Ubuntu & Debian based systems 2995

Installation on Cygwin 2995

Installation on OS X 296

Setting up Bazaar-NG 297

Getting Drupal Head via Bazaar-NG 2997

Hacking your local Drupal 2998

Updating your Branch with Official Drupal Dev 2998

Getting Merged 299

Getting a diff against core/head 2999

Was this article helpful?

0 0

Post a comment