Programmer's Guide to Drupal

Book description

If you’re a web programmer new to Drupal, this book shows you which programming techniques you can use—and which you should avoid—when building custom web applications with this content management framework.

Table of contents

  1. A Programmer’s Guide to Drupal
  2. Preface
    1. Intended Audience
    2. How to Use This Book
    3. Drupal Versions
    4. Where to Find More Information
      1. Drupal Site Building and General Drupal Information
      2. Drupal Programming Reference and Background
      3. PHP Resources
      4. Database Resources
      5. Other Web Technology Resources
    5. Conventions Used in This Book
    6. Using Code Examples
    7. Safari® Books Online
    8. How to Contact Us
    9. Acknowledgments
  3. 1. Overview of Drupal
    1. What Is Drupal?
      1. Drupal Core
      2. Drupal Add-Ons: Modules, Themes, Distributions, and Translations
        1. Finding Drupal add-ons
    2. How Drupal Handles URL Requests
    3. The Drupal Cache
  4. 2. Drupal Programming Principles
    1. Principle: Drupal Is Alterable
      1. Programming with Hooks in Modules and Themes
      2. Making Your Output Themeable
    2. Principle: Drupal Is International
      1. Internationalizing User Interface Text
      2. Internationalizing User-Entered Text
    3. Principle: Drupal Is Accessible and Usable
    4. Principle: Drupal Is Database Independent
      1. Setting Up Database Tables: Schema API and hook_update_N()
      2. Querying the Database with the Database API
        1. Very simple queries
        2. Dynamic queries
    5. Principle: Drupal Is Secure; User Input Is Insecure
      1. Cleansing and Checking User-Provided Input
      2. Checking Drupal Permissions
        1. Drupal core’s main permission system
        2. Permissions and security in forms
        3. Permissions in displaying and operating on content
    6. Principle: Drupal Code Is Tested and Documented
  5. 3. Common Drupal Programming Mistakes
    1. Mistake: Programming Too Much
      1. Avoiding Custom Programming with Fielded Data
      2. Defining Theme Regions for Block Placement
    2. Mistake: Misusing the Drupal API
      1. Mistake: Executing Code on Every Page Load
      2. Mistake: Using an Overly General Hook
    3. Mistake: Saving PHP Code in the Database
    4. Mistake: Working Alone
      1. Participating in Groups
      2. Reporting Issues and Contributing Code to the Drupal Community
      3. Contributing to the Drupal Community in Other Ways
  6. 4. Drupal Programming Examples
    1. Registering for URLs and Displaying Content
      1. Registering for a URL
      2. Altering a URL Registration
      3. Registering a Block
      4. Providing Page and Block Output
        1. Generating paged output
      5. Generating Forms with the Form API
        1. Using confirmation forms
        2. Altering forms
        3. Adding AJAX, JavaScript, and auto-complete to forms
    2. Programming with Entities and Fields
      1. Terminology of Entities and Fields
      2. Defining an Entity Type
        1. Step 1: Implement hook_entity_info()
        2. Step 2: Implement hook_schema()
        3. Step 3: Add pre-defined fields in hook_install()
        4. Step 4: Set up display
        5. Step 5: Set up editing and management
      3. Defining a Field Type
      4. Programming with Field Widgets
        1. Defining a field widget
        2. Repurposing an existing field widget
      5. Programming with Field Formatters
    3. Creating Views Module Add-Ons
      1. Views Programming Terminology and Output Construction
      2. Setting Up Your Module for Views
      3. Providing a New Views Data Source
      4. Adding Fields and Relationships to an Existing Views Data Source
      5. Providing a Display Plugin to Views
      6. Providing Default Views
    4. Creating Rules Module Add-Ons
      1. Providing Custom Actions to Rules
      2. Providing Default Rules
  7. 5. Programming Tools and Tips
    1. Drupal Development Tools
    2. Finding Drupal API Functions
    3. Other Programming Tips and Suggestions
  8. Colophon
  9. Copyright

Product information

  • Title: Programmer's Guide to Drupal
  • Author(s):
  • Release date: December 2012
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781449343316