Learning Drupal 6 Module Development

Matt Butcher

eBook: $23.99
Formats: PDF, PacktLib, ePub and Mobi formats
$15.59 save 35%!
Print book: $39.99
$35.99 save 10%!
Print + eBook bundle: $63.98
Includes free access to the book on PacktLib
$39.59 save 38%!
Free Shipping! UK, US, Europe and selected countries in Asia.
This book can also be purchased from:
Overview
Table of Contents
The Author
Reviews
Downloads
  • Specifically written for Drupal 6 development
  • Program your own Drupal modules
  • No experience of Drupal development required
  • Know Drupal 5? Learn what's new in Drupal 6
  • Integrate AJAX functionality with the jQuery library
  • Packt donates a percentage of every book sold to the Drupal foundation

Book Details

Language : English
Paperback : 328 pages [ 235mm x 191mm ]
Release Date : May 2008
ISBN : 1847194443
ISBN 13 : 978-1-847194-44-2
Author(s) : Matt Butcher
Topics and Technologies : All Books, Drupal


Table of Contents

Preface
Chapter 1: Introduction to Drupal Modules
Chapter 2: Creating Our First Module
Chapter 3: The Theme System
Chapter 4: Theming Modules
Chapter 5: Using JavaScript and AJAX/JSON in Modules
Chapter 6: An Administration Module
Chapter 7: Building a Content Type
Chapter 8: Filters, Actions, and Hooks
Chapter 9: An Installation Profile
Index
  • Chapter 1: Introduction to Drupal Modules
    • Drupal's Architecture
      • Module Architecture
        • Core Modules
        • Hooks
      • Themes
    • Crucial Drupal Concepts
      • Nodes
        • Comments Are Not Nodes
      • Users
        • Access and Security
      • Blocks and Page Rendering
      • Menus
      • Forms
      • Database and Schema APIs
    • Developers' Tools
      • Developer Module
      • Coder Module
    • A Word on Our Demonstration Site
    • Summary
  • Chapter 2: Creating Our First Module
    • Starting Out
      • A Place for the Module
      • Creating a .info File
    • A Basic .module File
      • Our Goal: A Block Hook
      • Starting the .module
      • The hook_block() Implementation
        • The t() Function
        • A view Operation
    • Installing a Module
      • Step 1: Copying the Module
      • Step 2: Enabling the Module
      • Step 3: Displaying the Module's Content
    • Using Goodreads Data
      • Modifying the Block Hook
      • Retrieving XML Content over HTTP
        • The watchdog() Function
      • Processing the HTTP Results
      • Formatting the Block's Contents
    • Finishing Touches: hook_help()
    • Summary
  • Chapter 3: The Theme System
    • The Theme System's Architecture
      • Theme Templates
      • Theme Engines
      • Theme Hooks
    • Creating a Custom Theme
      • Organization of Themes
        • Sub-themes (Derivative Themes)
        • How Each Theme Functions
      • Creating a Theme
        • Creating the Theme Directory
        • A .info File
        • A CSS Stylesheet
      • A PHPTemplate Theme
        • Template Structure
        • A Page Template for Descartes
        • Using PHP to Override Theme Behavior
        • template.php Gotchas
        • Creating a Screenshot
      • From Here to a Full Theme
    • Summary
  • Chapter 4: Theming Modules
    • Our Target Module: What We Want
    • Creating a Custom Content Type
      • Using the Administration Interface to Create a Content Type
        • Content and Nodes
    • The Foundations of the Module
    • A Simple Database Lookup
      • Getting the Node ID
      • Getting the Node's Content
    • Theming Inside a Module
      • Registering a Theme
      • Creating a Theme Hook Function
      • Adding a Stylesheet
    • Overriding the Default Theme from a Theme
      • A Quick Clarification
      • Overriding the Default Theme's CSS
      • Overriding Layout with Templates
    • Summary
  • Chapter 5: Using JavaScript and AJAX/JSON in Modules
    • Picking up Where We Left Off
    • Introducing jQuery
      • Modifying HTML with jQuery
      • Checking for JavaScript Support with Drupal
        • Namespaces in JavaScript
        • Drupal's Namespace
        • A Drupal Function: Drupal.jsEnabled()
      • Delaying JavaScript Execution with jQuery
      • Including JavaScript from the Module's Theme
    • Writing a Drupal AJAX/JSON Service
      • The JSON Format
      • Our Module Roadmap
      • Server Side: Defining a New Page
        • Creating a JSON Message
        • Mapping a Function to a URL
        • Passing PHP Settings to JavaScript
      • Client Side: AJAX Handlers
        • A JavaScript Function to Get JSON Content
        • Adding an Event Handler
    • Summary
  • Chapter 6: An Administration Module
    • The emailusers Module
    • The Beginning of the Module
      • Mail Configuration
    • Registering an Administration Page
      • A Detailed Look at the Path
        • Marking the Path as an Administration Page
      • Path Registration Parameters
      • Defining the Callback Function
    • Handling Forms with the Forms API (FAPI)
      • Loading a Form with drupal_get_form()
      • A Form Constructor
      • Handling Form Results
      • The Form Submissions Callback
    • Sending Mail with the Mail API
      • Formatting Mail with hook_mail()
      • Altering Messages with hook_mail_alter()
        • Altering Hooks
        • Adding a Mail Footer
    • Incorporating the Module into Administration
      • Modifying the User Profile with hook_user()
        • Constructing the Content
    • Summary
  • Chapter 7: Building a Content Type
    • The biography Module
    • The Content Creation Kit
    • The Starting Point
    • The Module Installation Script
      • The Schema API: Defining Database Structures
        • A First Look at the Table Definition
        • Defining Fields (Columns)
        • Defining Keys and Indexes
    • Correlating the New Table with Nodes
    • The Content Creation Form
      • Overriding hook_form() Defaults
      • Adding New hook_form() Form Elements
  • Access Controls
  • Database Hooks
    • Database Inserts with hook_insert()
    • Updating and Deleting Database Records
  • Hooks for Getting Data
    • Loading a Node with hook_load()
    • Preparing the Node for Display with hook_view()
  • Theming Biography Content
    • Registering a Theme
    • The biography_info.tpl.php Template
    • The Results
  • Summary
  • Chapter 8: Filters, Actions, and Hooks
    • The sitenews Module
    • Getting Started
      • Citing Dependencies in the .info File
      • The Beginning of the .module File
    • A Simple Content Type, Defined in Code
    • Creating Filters and an Input Format
      • The Second Filter: Remove All Tags
    • Adding an Input Format
  • The Beginning of an Action
    • Implementing hook_action_info()
    • The Action Callback
  • Defining a Hook
    • Invoking a Custom Hook
      • So What Is a Hook?
    • Creating a hook_sitenews() Function
    • Implementing hook_sitenews() in Other Modules
      • In the philquotes Module
      • In the biography Module
  • Completing the Action: Theming and Mailing
    • Theme Functions
    • The hook_mail() Implementation
  • Adding a Trigger
  • Summary
  • Chapter 9: An Installation Profile
    • Introducing Installation Profiles
      • Why Use Installation Profiles?
    • Setting up a Distribution
      • Creating a Profile Directory
    • Programming Profiles
    • The .profile Script
      • The Details Function
      • The Modules List
    • The Installation Task System
      • The Profile Task
        • A Basic Profile Task
        • A Complex Profile Task
        • Moving to the Next Task
      • Registering a New Task
      • The Theme Selection Form
      • Returning to the philosopherbios_pick_theme Task
        • The Submission Handler
      • Finishing the Installation Profile
    • Packaging the Distribution
    • Summary

Matt Butcher

Matt is a web developer and author. He has previously written five other books for Packt, including two others on Drupal. He is a senior developer for the New York Times Company, where he works on ConsumerSearch.com, one of the most traffic-heavy Drupal sites in the world. He is the maintainer of multiple Drupal modules and also heads QueryPath – a jQuery-like PHP library. He blogs occasionally athttp://technosophos.com.

 

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Find your book in our support section to find errata and to download code samples.

What you will learn from this book

  • A developer's overview of important Drupal concepts and APIs, like nodes, menus, and forms
  • Using Drupal tools for module development
  • Creating a new module from scratch
  • Harnessing the power of the Drupal hook system
  • Using key Drupal functions
  • Creating custom content types, from basic to advanced
  • Performing database operations
  • Writing module installers and uninstallers
  • Making Drupal content available to JavaScript with a JSON service
  • Interacting with the theme system to build crisp layouts
  • Creating richer user interfaces with Drupal's JavaScript libraries
  • Working with blocks, nodes, actions, and menus
  • Using a web service to retrieve and display XML data
  • Creating an administration interface
  • Customizing user profiles
  • Writing actions and triggering them with events
  • Working with the Forms API
  • Defining custom hooks and making modules work together
  • Exploring the database and schema API
  • Creating an installation profile to bundle your modules into a custom Drupal distribution

Special Offers

PacktLib gives you access to this and 600+ other titles with an annual or monthly subscription.

Annual subscription:

$220.00 per annum

Monthly subscription:

$21.99 per month

Buy 2 eBooks
and Get 50% Off
+
Buy Learning Drupal 6 Module Development with Drupal 7 Module Development and get 50% off both the eBooks.
Just add both the eBooks to your shopping cart and enter 76mdebk in the 'Enter Promotion Code' field. Click 'Add Promotion Code' and the discount will be applied.
View more Drupal book offers here  |  View Best Selling eBook offers

In Detail

With great power comes... tremendous flexibility. Drupal is an award-winning open-source Content Management System, and the feature-packed sixth release is right around the corner. It's a modular system, with an elegant hook-based architecture, and great code. These are a few of the perks that make Drupal a choice platform for developers who want the power of an established CMS, but the freedom to make it work for them. From social networking to AJAX to e-commerce, the hundreds of existing modules attest to Drupal's flexibility. When you create a new module for Drupal, it fits seamlessly into the look and feel of your overall site. If you can think it in PHP, you can code it as a Drupal module.

Dive into Drupal module development as we create the Philosopher Biographies website, developing new modules and themes to meet practical goals. Create custom content types. Add AJAX functionality with the jQuery library. Use external XML APIs to add content to your site. Email newsletters to site members. Use themes. Empower administrators with extra features. And bundle it all up in a custom installation profile. You won't find a "hello world" here!

If you're eager to start creating modules for Drupal 6, this is your book. Walk through the development of complete Drupal modules with this primer for PHP programmers. Specifically written for Drupal 6, this book will get you coding modules as quickly as possible, and help you add the features that will give your work that professional gloss!

Just getting started with Drupal development? This book will give you a clear, concise and, of course, practical guidance to take you from the basics of creating your first module to developing the skills to make you a Drupal developer to be reckoned with.

Are you a Drupal developer looking to update to version 6? This book covers the new and updated APIs to guide your transition to Drupal 6. The new menu system, the Forms and Schema APIs, and many core revisions are covered in this book.

Walk through the development of complete Drupal 6 modules with this primer for PHP programmers, written specifically for Drupal 6 to get you started coding your first module.

Are you a Drupal developer looking to update to version 6? This book covers the new and updated APIs to guide your transition to Drupal 6. The new menu system, the Forms and Schema APIs, and many core revisions are covered in this book.

 

Approach

Who this book is for

This book is written for PHP developers who want to add custom features to Drupal. You will need to know the basics of PHP and MySQL programming, but no experience of programming Drupal is required, although you will be expected to be familiar with the basic operation of Drupal.

Are there no books available that are right for you at the moment? How about signing up to our newsletter to keep up to date?
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Sort A-Z