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.
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
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.
Learn the ins and outs of writing custom modules, themes, installation profiles and libraries for the Drupal PHP content management system.
Table of Contents
Drupal 7 Module Development
- About the Authors
- About the Reviewers
1. Developing for Drupal 7
- Introducing Drupal (for developers)
- Drupal architecture
- Drupal's major subsystems
- Tools for developing Drupal code
2. Creating Your First Module
- Our goal: a module with a block
- Creating a new module
- Working with the Block API
- Writing automated tests
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?
4. Theming a Module
- Reusing a default theme implementation
- Steps to build a default theme implementation
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
6. Working with Content
- Why create your own entities
- The goal
- The Schema API
- Declaring our entity
- Entity management
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
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
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
- Using drupal_add_js()
- Using the Library API
- Using renderable arrays
- Adding AJAX to forms
- AJAX automatically applied
- AJAX commands
- 11. Working with Files and Images
12. Installation Profiles
- Introducing installation profiles
- Drupal distributions
- Creating profiles
- Running the installer from the command line
- A. Database Access
- B. Security
- Title: Drupal 7 Module Development
- Release date: December 2010
- Publisher(s): Packt Publishing
- ISBN: 9781849511162