You are previewing Pro Drupal Development, Second Edition.
O'Reilly logo
Pro Drupal Development, Second Edition

Book Description

Widely praised for its in-depth coverage of Drupal internals, bestselling Pro Drupal Development has been updated for Drupal 6 in this edition, and provides are even more tricks of the trade to help you further yourself as a professional Drupal developer.

Assuming you already know how to install and bring a standard installation online, John K. VanDyk gives you everything else you need to customize your Drupal installation however you see fit. Pro Drupal Development, Second Edition delves deep into Drupal internals, showing you how to take full advantage of its powerful architecture.

What you'll learn

  • Find out how to create your own modules, develop your own themes, and produce your own filters.

  • Learn the inner workings of each key part of Drupal, including user management, sessions, the node system, caching, and the various APIs available to you.

  • Discover how to optimize your Drupal installation to perform well under high-load situations.

  • Gain the knowledge needed to secure your Drupal installation and other best practice techniques.

  • Learn to integrate Ajax into and internationalize your Drupal web site.

  • Who this book is for

    Web developers maintaining and creating sites with Drupal. It is assumed that you already know the basics of Drupal and are able to install and bring up a basic installation. This book takes you deeper into the internals of Drupal and teaches how to tweak and modify it in order to create that perfect web site. Simply put, if you are working with Drupal, you need Pro Drupal Development, Second Edition.

What you'll learn

  • Develop conceptual models of client data using interviews and client documentation

  • Normalize data models to enhance scalability and the long term use of valuable data

  • Translate conceptual models into high-performing SQL Server databases

  • Secure and protect the integrity of data as part of meeting regulatory requirements

  • Take full advantage of new SQL Server features such as the spatial datatype, XML support, transparent data encryption, and more

  • Create effective indexing to speed query performance

Who this book is for

Pro SQL Server 2008 Relational Database Design and Implementation is designed for programmers of all types who want to use SQL Server 2008 to store data. Rookie database programmers will find a complete course on the fundamentals of database design that includes conceptual designs and physical implementation. Seasoned veterans will find many tips and tricks for implementing database systems that will be well worth the time invested in reading this book.

Table of Contents

  1. Title Page
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. Foreword
  6. About the Author
  7. About the Technical Reviewer
  8. Acknowledgments
  9. Introduction
  10. CHAPTER 1: How Drupal Works
    1. What Is Drupal?
    2. Technology Stack
    3. Core
    4. Administrative Interface
    5. Modules
    6. Hooks
    7. Themes
    8. Nodes
    9. Blocks
    10. File Layout
    11. Serving a Request
    12. Summary
  11. CHAPTER 2: Writing a Module
    1. Creating the Files
    2. Implementing a Hook
    3. Adding Module-Specific Settings
    4. Adding the Data Entry Form
    5. Defining Your Own Administration Section
    6. Presenting a Settings Form to the User
    7. Validating User-Submitted Settings
    8. Storing Settings
    9. Further Steps
    10. Summary
  12. CHAPTER 3: Hooks, Actions, and Triggers
    1. Understanding Events and Triggers
    2. Understanding Actions
    3. Using the Context in Actions
    4. Examining the Context
    5. How Actions Are Stored
    6. Calling an Action Directly with actions_do()
    7. Defining Your Own Triggers with hook_hook_info()
    8. Adding Triggers to Existing Hooks
    9. Summary
  13. CHAPTER 4: The Menu System
    1. Callback Mapping
    2. Menu Nesting
    3. Access Control
    4. Title Localization and Customization
    5. Wildcards in Menu Items
    6. Altering Menu Items from Other Modules
    7. Altering Menu Links from Other Modules
    8. Kinds of Menu Items
    9. Common Tasks
    10. Using menu.module
    11. Common Mistakes
    12. Summary
  14. CHAPTER 5: Working with Databases
    1. Defining Database Parameters
    2. Understanding the Database Abstraction Layer
    3. Connecting to the Database
    4. Performing Simple Queries
    5. Retrieving Query Results
    6. The Schema API
    7. Inserts and Updates with drupal_write_record()
    8. Exposing Queries to Other Modules with hook_db_rewrite_sql()
    9. Connecting to Multiple Databases Within Drupal
    10. Using a Temporary Table
    11. Writing Your Own Database Driver
    12. Summary
  15. CHAPTER 6: Working with Users
    1. The $user Object
    2. Introduction to hook_user()
    3. The User Registration Process
    4. The Login Process
    5. External Login
    6. Summary
  16. CHAPTER 7: Working with Nodes
    1. So What Exactly Is a Node?
    2. Not Everything Is a Node
    3. Creating a Node Module
    4. How Nodes Are Stored
    5. Creating a Node Type with CCK
    6. Restricting Access to Nodes
    7. Summary
  17. CHAPTER 8: The Theme System
    1. Theme System Components
    2. Installing a Theme
    3. Building a PHPTemplate Theme
    4. Understanding Template Files
    5. Advanced Drupal Theming
    6. Summary
  18. CHAPTER 9: Working with Blocks
    1. What Is a Block?
    2. Block Configuration Options
    3. Block Placement
    4. Defining a Block
    5. Building a Block
    6. Enabling a Block When a Module Is Installed
    7. Block Visibility Examples
    8. Summary
  19. CHAPTER 10: The Form API
    1. Understanding Form Processing
    2. Creating Basic Forms
    3. Form API Properties
    4. Summary
  20. CHAPTER 11: Manipulating User Input: The Filter System
    1. Filters
    2. Filters and Input Formats
    3. Creating a Custom Filter
    4. Protecting Against Malicious Data
    5. Summary
  21. CHAPTER 12: Searching and Indexing Content
    1. Building a Custom Search Page
    2. Using the Search HTML Indexer
    3. Summary
  22. CHAPTER 13: Working with Files
    1. How Drupal Serves Files
    2. PHP Settings
    3. Media Handling
    4. File API
    5. Summary
  23. CHAPTER 14: Working with Taxonomy
    1. What Is Taxonomy?
    2. Kinds of Taxonomy
    3. Viewing Content by Term
    4. Storing Taxonomies
    5. Module-Based Vocabularies
    6. Common Tasks
    7. Taxonomy Functions
    8. Additional Resources
    9. Summary
  24. CHAPTER 15: Caching
    1. Knowing When to Cache
    2. How Caching Works
    3. How Caching Is Used Within Drupal Core
    4. Summary
  25. CHAPTER 16: Sessions
    1. What Are Sessions?
    2. Usage
    3. Session-Related Settings
    4. Storage
    5. Session Life Cycle
    6. Session Conversations
    7. Common Tasks
    8. Summary
  26. CHAPTER 17: Using jQuery
    1. What Is jQuery?
    2. The Old Way
    3. How jQuery Works
    4. jQuery Within Drupal
    5. Building a jQuery Voting Widget
    6. Next Steps
    7. Summary
  27. CHAPTER 18: Localization and Translation
    1. Enabling the Locale Module
    2. User Interface Translation
    3. Starting a New Translation
    4. Installing a Language Translation
    5. Right-to-Left Language Support
    6. Language Negotiation
    7. Content Translation
    8. Localization- and Translation-Related Files
    9. Additional Resources
    10. Summary
  28. CHAPTER 19: XML-RPC
    1. What Is XML-RPC?
    2. Prerequisites for XML-RPC
    3. XML-RPC Clients
    4. A Simple XML-RPC Server
    5. Built-In XML-RPC Methods
    6. Summary
  29. CHAPTER 20: Writing Secure Code
    1. Handling User Input
    2. Handling URLs Securely
    3. Making Queries Secure with db_query()
    4. Keeping Private Data Private with db_rewrite_sql()
    5. Dynamic Queries
    6. Permissions and Page Callbacks
    7. Cross-Site Request Forgeries (CSRF)
    8. File Security
    9. Encoding Mail Headers
    10. Protecting cron.php
    11. SSL Support
    12. Stand-Alone PHP
    13. AJAX Security
    14. Form API Security
    15. Protecting the Superuser Account
    16. Using eval()
    17. Summary
  30. CHAPTER 21: Development Best Practices
    1. Coding Standards
    2. PHP Comments
    3. Checking Your Coding Style Programmatically
    4. Finding Your Way Around Code with egrep
    5. Taking Advantage of Version Control
    6. Creating and Applying Patches
    7. Maintaining a Module
    8. Mixing SVN with CVS for Project Management
    9. Testing and Developing Code
    10. The Module Builder Module
    11. Application Profiling and Debugging
    12. Summary
  31. CHAPTER 22: Optimizing Drupal
    1. Finding the Bottleneck
    2. Drupal-Specific Optimizations
    3. Architectures
    4. Summary
  32. CHAPTER 23: Installation Profiles
    1. Where Profiles Are Stored
    2. How Installation Profiles Work
    3. Summary
  33. APPENDIX A: Database Table Reference
    1. access (user module)
    2. accesslog (statistics module)
    3. actions (trigger module)
    4. actions_aid (trigger module)
    5. aggregator_category (aggregator module)
    6. aggregator_category_feed (aggregator module)
    7. aggregator_category_item (aggregator module)
    8. aggregator_feed (aggregator module)
    9. aggregator_item (aggregator module)
    10. authmap (user module)
    11. batch (batch.inc)
    12. blocks (block module)
    13. blocks_roles (block module)
    14. book (book module)
    15. boxes (block module)
    16. cache
    17. cache_block (block module)
    18. cache_filter (filter module)
    19. cache_form
    20. cache_menu
    21. cache_page
    22. cache_update
    23. comments (comment module)
    24. contact (contact module)
    25. files (upload module)
    26. filter_formats (filter module)
    27. filters (filter module)
    28. flood (contact module)
    29. forum (forum module)
    30. history (node module)
    31. languages (locale module)
    32. locales_source (locale module)
    33. locales_target (locale module)
    34. menu_custom (menu module)
    35. menu_links (menu module)
    36. menu_router
    37. node (node module)
    38. node_access (node module)
    39. node_comment_statistics (comment module)
    40. node_counter (statistics module)
    41. node_revisions (node module)
    42. node_type (node module)
    43. openid_association (openid module)
    44. permission (user module)
    45. poll (poll module)
    46. poll_choices (poll module)
    47. poll_votes (poll module)
    48. profile_fields (profile module)
    49. profile_values (profile module)
    50. role (user module)
    51. search_dataset (search module)
    52. search_index (search module)
    53. search_node_links (search module)
    54. search_total (search module)
    55. sessions
    56. system
    57. term_data (taxonomy module)
    58. term_hierarchy (taxonomy module)
    59. term_node (taxonomy module)
    60. term_relation (taxonomy module)
    61. term_synonym (taxonomy module)
    62. trigger_assignments (trigger module)
    63. upload (upload module)
    64. url_alias (path module)
    65. users (user module)
    66. users_roles (users)
    67. variable
    68. vocabulary (taxonomy module)
    69. vocabulary_node_types (taxonomy module)
    70. watchdog (dblog module)
  34. APPENDIX B: Resources
    1. Code
    2. Handbooks
    3. Forums
    4. Mailing Lists
    5. User Groups and Interest Groups
    6. Internet Relay Chat
    7. Videocasts
    8. Weblogs
    9. Conferences
    10. Contribute
  35. Index