Drupal 7 Module Development

For PHP developers, this is the most practical book available if you want to start coding within Drupal. Every chapter has working code samples, allowing you to establish a great foundation for building your own tools.

Drupal 7 Module Development

Progressing
Matt Butcher et al.

For PHP developers, this is the most practical book available if you want to start coding within Drupal. Every chapter has working code samples, allowing you to establish a great foundation for building your own tools.
$26.99
$40.50
RRP $26.99
RRP $44.99
eBook
Print + eBook
$12.99 p/month

Get Access

Get Unlimited Access to every Packt eBook and Video course

Enjoy full and instant access to over 3000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781849511162
Paperback420 pages

About This Book

  • Specifically written for Drupal 7 development
  • Write your own Drupal modules, themes, and libraries
  • Discover the powerful new tools introduced in Drupal 7
  • Learn the programming secrets of six experienced Drupal developers
  • Get practical with this book's project-based format

Who This Book Is For

If you are a PHP developer or a Drupal user looking to dive into Drupal development then you will find this book an excellent introduction to coding within Drupal.

Those with some Drupal experience will also find this an invaluable tool for updating their knowledge about the powerful new features of Drupal 7. Theme developers looking to extend their abilities will find this an accessible introduction to PHP coding within the Drupal environment.

This book assumes that you are familiar with basic PHP programming, along with HTML and CSS.
No experience with programming Drupal is required, although it is also a handy way for experienced Drupal developers to get up to speed with Drupal 7.

 

Table of Contents

Chapter 1: Developing for Drupal 7
Introducing Drupal (for developers)
Drupal architecture
Drupal's major subsystems
Tools for developing Drupal code
Summary
Chapter 2: Creating Your First Module
Our goal: a module with a block
Creating a new module
Working with the Block API
Writing automated tests
Summary
Chapter 3: Drupal's Theme Layer
Business logic versus presentation logic
Data granularity
Theme engines
Two ways to theme
Render elements
The power of theme()
Theme registry
What else?
Summary
Chapter 4: Theming a Module
Reusing a default theme implementation
Steps to build a default theme implementation
Summary
Chapter 5: Building an Admin Interface
The User Warn module
Starting our module
The Drupal menu system
Form API
Sending mail with drupal_mail() and hook_mail()
The token system
Summary
Chapter 6: Working with Content
Why create your own entities
The goal
Bundles
The Schema API
Declaring our entity
Entity management
Summary
Chapter 7: Creating New Fields
Our goal: a "dimensions" field
How Field API works
Creating our new field type
Exposing fields to the Form API with widgets
Using formatters to display our field
Managing non-Field fields
Finding entities and fields
Summary
Chapter 8: Drupal Permissions and Security
Using user_access() to assert permissions
Checking the proper user account
Using hook_permission()
Declaring your own access functions
Responding when access is denied
Enabling permissions programmatically
Defining roles programmatically
Securing forms in Drupal
Handling AJAX callbacks securely
Summary
Chapter 9: Node Access
Node Access compared to user_access() and other permission checks
Using hook_node_access()
When to write a node access module
Creating the role access module
Modifying the behavior of other modules
Testing and debugging your module
Summary
Chapter 10: JavaScript in Drupal
JavaScript inside Drupal
Adding JavaScript
Altering JavaScript
Drupal specific JavaScript
AJAX helpers
Summary
Chapter 11: Working with Files and Images
The Twitpic and watermark modules
Files in Drupal
File API
Stream wrappers
Images in Drupal
Summary
Chapter 12: Installation Profiles
Introducing installation profiles
Drupal distributions
Creating profiles
Running the installer from the command line
Summary

What You Will Learn

  • Build modules extending Drupal's core functionality
  • Create custom content types and entities
  • Learn how to work with Drupal's hook system
  • Explore the major APIs introduced in Drupal 7 that the pros use to build successful Drupal websites
  • Test your code programatically with Drupal's new Simple Test framework
  • Build and extend themes to make your Drupal 7 shine
  • Author interactive form-based tools with Drupal's Forms API
  • Apply the principals of Test Drive Development (TDD) using Drupal's built-in SimpleTest framework
  • Leverage the book's working module examples as a starting point for you own code
  • Discover the secrets of Drupal professionals as they explain the practical aspects of good Drupal development

In Detail

Drupal is an award-winning open-source Content Management System. It's a modular system, with an elegant hook-based architecture, and great code. Modules are plugins for Drupal that extend, build or enhance Drupal core functionality.

In Drupal 7 Module development book, six professional Drupal developers use a practical, example-based approach to introduce PHP developers to the powerful new Drupal 7 tools, APIs, and strategies for writing custom Drupal code.

These tools not only make management and maintenance of websites much easier, but they are also great fun to play around with and amazingly easy to use.

If you're eager to learn about these new APIs and start creating modules for Drupal 7, this is your book. Walk through the development of complete Drupal modules with this primer for PHP programmers.

From basic modules and themes to sophisticated Drupal extensions, learn how to use Drupal's API and hook system to build powerful custom Drupal websites. With an emphasis on practical programming, this book takes a project-based approach, providing working examples in every chapter
Specifically written for Drupal 7, 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!

This book will walk you through the development of complete Drupal modules and show you how to add various features to meet your requirements.

The Drupal content management system, written in the popular PHP language, has skyrocketed in popularity.

Developers for this system are in high demand. This book prepares PHP developers for Drupal development, explaining architecture, exploring APIs, and emphasizing practical approaches.

In each chapter, readers will learn new aspects of the system while creating fully-functioning modules, themes, and libraries. Learn how to “hook into” any part of the Drupal process, creating custom content types, extending existing capabilities, and integrating with external services and applications.

Authors

Table of Contents

Chapter 1: Developing for Drupal 7
Introducing Drupal (for developers)
Drupal architecture
Drupal's major subsystems
Tools for developing Drupal code
Summary
Chapter 2: Creating Your First Module
Our goal: a module with a block
Creating a new module
Working with the Block API
Writing automated tests
Summary
Chapter 3: Drupal's Theme Layer
Business logic versus presentation logic
Data granularity
Theme engines
Two ways to theme
Render elements
The power of theme()
Theme registry
What else?
Summary
Chapter 4: Theming a Module
Reusing a default theme implementation
Steps to build a default theme implementation
Summary
Chapter 5: Building an Admin Interface
The User Warn module
Starting our module
The Drupal menu system
Form API
Sending mail with drupal_mail() and hook_mail()
The token system
Summary
Chapter 6: Working with Content
Why create your own entities
The goal
Bundles
The Schema API
Declaring our entity
Entity management
Summary
Chapter 7: Creating New Fields
Our goal: a "dimensions" field
How Field API works
Creating our new field type
Exposing fields to the Form API with widgets
Using formatters to display our field
Managing non-Field fields
Finding entities and fields
Summary
Chapter 8: Drupal Permissions and Security
Using user_access() to assert permissions
Checking the proper user account
Using hook_permission()
Declaring your own access functions
Responding when access is denied
Enabling permissions programmatically
Defining roles programmatically
Securing forms in Drupal
Handling AJAX callbacks securely
Summary
Chapter 9: Node Access
Node Access compared to user_access() and other permission checks
Using hook_node_access()
When to write a node access module
Creating the role access module
Modifying the behavior of other modules
Testing and debugging your module
Summary
Chapter 10: JavaScript in Drupal
JavaScript inside Drupal
Adding JavaScript
Altering JavaScript
Drupal specific JavaScript
AJAX helpers
Summary
Chapter 11: Working with Files and Images
The Twitpic and watermark modules
Files in Drupal
File API
Stream wrappers
Images in Drupal
Summary
Chapter 12: Installation Profiles
Introducing installation profiles
Drupal distributions
Creating profiles
Running the installer from the command line
Summary

Book Details

ISBN 139781849511162
Paperback420 pages
Read More