You are previewing The Definitive Guide to Drupal 7.
O'Reilly logo
The Definitive Guide to Drupal 7

Book Description

The Definitive Guide to Drupal 7 is the most comprehensive book for building web sites using the powerful and extensible Drupal content management framework.

Written by active community members and contributors (some of the "brightest and most innovative minds in the Drupal community," to quote Angela Byron, Drupal 7 maintainer), the Definitive Guide to Drupal 7 covers the basics then quickly advances to in-depth exploration of the functionality and tools that make Drupal so powerful for building web applications. Just as important, this book provides the reader with a guide to participating in the Drupal community: an international, committed, rapidly growing community of themers, developers, and open source advocates who write the modules, test the code, and work ceaselessly to make Drupal great. The release of Drupal 7, with its dramatic improvements in usability and system architecture, will take Drupal to a new level of popularity, and this book will help give you the foundation and scaffolding to grow with Drupal.

With The Definitive Guide to Drupal 7, you will be able to:

  • Plan and build a complete Drupal site with core alone.

  • Extend Drupal's functionality by selecting from thousands of modules.

  • Make your Drupal site look like anything you want with theming and jQuery.

  • Extend Drupal by coding your own modules.

  • Install Drupal in many environments.

  • Use essential tools such as Drush and Git to make your life easier.

  • Contribute to the Drupal community as an organizer or a coder.

Who this book is for Anyone who is serious about getting better at Drupal.

Table of Contents

  1. Title Page
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. Foreword
  6. About the Authors
  7. About the Technical Reviewer
  8. Acknowledgments
  9. Preface: Why Drupal?
    1. Drupal Is a CMS for Building Dynamic Web Sites
    2. Drupal Is an Application Framework
    3. Drupal Is a Social and Semantic Web Platform
    4. Drupal Is a Community
    5. Drupal Is...
  10. What's New in Drupal 7
    1. Easier to Use
    2. More Flexible
    3. More Scalable
    4. Other Changes in 7
  11. How to Use This Book
  12. How Drupal Works
    1. How Drupal Works
    2. Planning a Drupal Project: Designing from the Content Out
  13. Part 1: Getting Started
    1. Chapter 1: Building a Drupal 7 Site
      1. Implementation
      2. Allowing People to Register and Log In with OpenID
      3. Time for a Celebratory Beverage
    2. Chapter 2: Essential Tools: Drush and Git
      1. A Beginner's Guide to Installing Drush
      2. Git: Development Grease
      3. Other Useful Git Commands
      4. Database Backup Tools
      5. Summary
  14. Part II: Site Building Foundations
    1. Chapter 3: Building Dynamic Pages Using Views
      1. What Are Views?
      2. The Views Administration Page
      3. Deconstructing a View
      4. Creating a Basic View
      5. Extend a View
      6. Advanced Views Implementations
      7. Other Modules
      8. Exporting to Code
      9. Additional Resources
    2. Chapter 4: There's a Module for That
      1. Modules for Drupal Are Constantly Evolving
      2. Fewer Modules Is Better
      3. How to Find and Choose a Module
      4. What to Do When Something's Wrong with a Module
      5. Modules in Core
      6. Where to Store Contributed Modules
      7. Site Building Essentials
      8. Other Modules That May Prove Useful
      9. The Beauty of It All
    3. Chapter 5: Creating Community Web Sites with Organic Groups
      1. Installing and Configuring Organic Groups
      2. Using Views with Organic Modules
      3. Creating Group Content
      4. Getting Started with Panels
      5. Members, Roles, and Permissions
      6. Summary
    4. Chapter 6: Security in Drupal
      1. Setting Up a Secure Drupal Site
      2. Security Process
      3. Summary
    5. Chapter 7: Updating Drupal
      1. Why Update
      2. Preparation
      3. Manual Update
      4. Drush Update
      5. Diff Update
      6. Contributed Modules
      7. Summary
    6. Chapter 8: Extending Your Site
      1. Showcasing Authors with Profile Pages
      2. Listing the Authors
      3. Fine-tuning Content Display
      4. Making the Table of Contents with Book Module
      5. Linking Chapters to Their Authors
      6. Adding a Resource Content Type That References Chapters
      7. Showing Content That References the Post Being Viewed
      8. Giving Faces to the People Posting on Your Site
      9. Adding a Text Format That Allows Images
      10. Limiting Access to the Suggestion Status Field
      11. Autogenerating Human-readable URLs with Pathauto
      12. Summary
  15. Part III: Making Your Life Easier
    1. Chapter 9: Drupal Community: Getting Help and Getting Involved
      1. How to Get the Most from Your Participation
      2. Where to Find the Community
      3. Summary
    2. Chapter 10: Planning and Managing a Drupal Project
      1. The Role of Limitations
      2. Putting Down Your Concept on Paper
      3. Project Management Methodologies and Drupal
      4. Taking the Lifecycle into Account on Paper
      5. Project Manager Tasks Beyond Development
      6. Other Tasks for Project Managers
      7. Further Resources
    3. Chapter 11: Documenting for End Users and the Production Team
      1. What Makes Good Documentation?
      2. Getting Clients into Content Entry Early
      3. Creating End-User Documentation Post-Launch
      4. The Anatomy of Good Client Documentation
      5. Documenting for the Development Team
      6. Documenting for the Community
      7. The More You Know
    4. Chapter 12: Development Environment
      1. Starting with Quickstart
      2. Enhancing Your Existing Dev Environment
      3. The Most Basic Development Environment
      4. Summary
    5. Chapter 13: Putting a Site Online and Deploying New Features
      1. Putting Your Site Online
      2. Before You Go Any Further, Back Up
      3. Staging and Deployment
      4. Summary
    6. Chapter 14: Developing from a Human Mindset
      1. Use Revision Control
      2. Backup
      3. Experiment Freely
      4. Contribute
  16. Part IV: Front-End Development
    1. Chapter 15: Theming
      1. The Core Themes Directory
      2. Theme Administration
      3. Defining Theme Metadata (.info Files)
      4. Working with Regions
      5. Template Files
      6. Theme Functions
      7. Theme Hooks and Theme Hook Suggestions
      8. Summary
    2. Chapter 16: Advanced Theming
      1. Finding Available Variables in the Theme Layer
      2. Preprocess and Process Functions
      3. Using the Render API
      4. Introducing render(), hide(), and show()
      5. Theming Forms
      6. Managing CSS Files
      7. Working with Base and Subthemes
      8. Sustainability and Best Practices
      9. Summary
    3. Chapter 17: jQuery
      1. Implementing jQuery and JavaScript
      2. jQuery UI
      3. Further jQuery Resources
      4. Summary
  17. Part V: Back-End Development
    1. Chapter 18: Introduction to Module Development
      1. A Very Simple Module
      2. Technical Skills
      3. Summary
    2. Chapter 19: Using Drupal's APIs in a Module
      1. Altering Forms
      2. Localization with t() and format_plural()
      3. Finding a Drupal Function That Does What You Need
      4. Creating a Page with hook_menu()
      5. Using Existing Permissions in Your Module
      6. A Second Local Task to Complement the Default Local Task
      7. Call All Implementations of a Hook
      8. Format Data for Display as a Table
      9. Making Modules Themeable
      10. Calling a Drupal Function Directly
      11. Styling Your Module: Adding a CSS File
      12. Database API
      13. Displaying Data in a Sortable Table
      14. Drupal Entities: Common Structure Behind Site Components
      15. Summary
    3. Chapter 20: Refining Your Module
      1. Creating a Configuration Page for Your Module
      2. Writing a Utility Function when Drupal APIs Miss Your Need
      3. Making Mistakes and Embracing Error Messages
      4. Making a Preprocess Function
      5. Final Considerations
      6. Summary
    4. Chapter 21: Porting Modules to Drupal 7
      1. Deciding to Upgrade a Module
      2. Undertaking the Upgrade
      3. Contributing the Upgrade to
    5. Chapter 22: WritingProject-Specific Code
      1. Custom Modules
      2. Hooks
      3. The Method
      4. Specific Use Cases
      5. Making Code Reusable
      6. Summary
    6. Chapter 23: Introduction to Functional Testing with Simpletest
      1. Advantages (and Caveats) of Using Simpletest
      2. When to Use Simpletest
      3. What Is Test-Driven Development (TDD)?
      4. How Simpletest Works
      5. Setting up and Running a Test
      6. Anatomy of a .test File
      7. Running Your First Test
      8. Simpletests and Forms
      9. The Simpletest API and Further Reading
      10. Submitting a Patch to
      11. Summary
    7. Chapter 24: Writing a Major Module
      1. How Not to Build a Module
      2. Know the Tools Drupal Gives You
      3. Should Your Module Provide an API?
      4. Making Your Module Modular
      5. Getting Started with a Test Environment
      6. Planning Your Approach
      7. Defining Your Data Model
      8. Providing a New Entity Type
      9. Giving Your Entities an Administrative Interface
      10. Programmatically Creating and Attaching Fields
      11. Define Done
  18. Part VI: Advanced Site-Building Topics
    1. Chapter 25: Drupal Commerce
      1. Drupal Commerce Overview
      2. Key Features
      3. Digging Into Drupal Commerce
      4. Implementing Drupal Commerce
      5. Development History
      6. Building on Drupal 7
      7. Summary
    2. Chapter 26: Drush
      1. Getting Started with Drush
      2. Applying Code Updates with Drush
      3. Installing Drush Extensions
      4. Going In-Depth with Drush Configuration Options and Aliases
      5. Using Remote Commands to Deploy Sites with Drush
      6. Scripting with Drush
      7. Writing Drush Extensions
      8. Summary
    3. Chapter 27: Scaling Drupal
      1. Do You Need to Care About Scaling?
      2. Cache
      3. Varnish
      4. On Databases
      5. MongoDB
      6. Summary
    4. Chapter 28: Spice Your Content Up With Tasty Semantics
      1. Information Overload
      2. How Did We Get There?
      3. Decentralized Dataspaces
      4. Linking Data at the Global Web Scale
      5. Do You See What I Mean?
      6. RDFa, or How HTML Can Be Augmented with Semantics
      7. RDFa, Microformats andMicrodata
      8. Drupal 7 and the Semantic Web
      9. Understanding the Structure of RDF Mappings
      10. Using RDF Beyond Drupal Core with the Contributed Modules
      11. Summary
    5. Chapter 29: The Menu System and the Path Into Drupal
      1. Drupal’s Menu System by Example
      2. The Never-ending Path
      3. Fitness
      4. Modifying Existing Router Items
      5. Summary
    6. Chapter 30: Under the Hood: Inside Drupal When It Displays a Page
      1. Bootstrap
      2. Execution of the Page Callback
      3. Summary
    7. Chapter 31: Search and Apache Solr Integration
      1. Search Results and Facet Blocks
      2. Search Module API
      3. Apache Solr Search Configuration
      4. Apache Solr Search Customization
      5. Integrating with the Apache Solr Server
      6. Summary
    8. Chapter 32: User Experience
      1. Modularity
      2. Human API
      3. Memory
      4. Long Term Memory
      5. Perception
      6. Law of Similarity
      7. Law of Proximity
      8. Color Harmony
      9. Practice
    9. Chapter 33: Completing a Site: The Other 90%
      1. Creating a View Mode
      2. Creating a Custom Theming Template
      3. Modifying the Chapter Number Field's Display
      4. Linking to and Twitter Accounts with Field Formatters
      5. Streamlining an Awkward Form Element with CSS
      6. Contextual “Add New” Links for Content Types
      7. Making a Custom Text Filter
      8. Making Next and Previous Links That Mimic Book Navigation
      9. Creating a View to Make User Pages Have Hackable URLs
      10. In Conclusion
    10. Chapter 34: Drupal Distributions and Installation Profiles
      1. Site Templates
      2. Creating Installation Profiles
      3. Dealing with Configuration: Features
      4. Packaging Your Code
      5. The Future of Distributions
      6. Summary
  19. Part VII: Drupal Community
    1. Chapter 35: Drupal’s Story: A Chain of Many Unexpected Events
      1. The Original Accident
      2. The Extended Weekend from Hell
      3. If You Have a Problem, Please Search Before Posting a Question
      4. The Story Continues
    2. Chapter 36: Now You’re in Business: Making a Living with Drupal
      1. Building a Drupal Site: New Rules for New Technologies
      2. Building Your Drupal Career
      3. Building Drupal: Making a Living as a Contributor
      4. Getting Better all the Time
    3. Chapter 37: Maintaining a Project
      1. What’s a Drupal Project?
      2. Set Up Your Account for Contributing
      3. Creating a Sandbox Project
      4. Status
      5. Project Information
      6. Digging in with Git
      7. From Sandboxville to Projectopolis
      8. Summary
    4. Chapter 38: Contributing to the Community
      1. Why Contribute?
      2. Ways to Contribute
      3. Building the Movement
  20. Part VIII: Appendix
    1. Appendix A: Upgrading a Drupal Site from 6 to 7
      1. Assess the Situation
      2. Run the Upgrade (Again and Again)
      3. Capturing Additional Upgrade Steps in Update Hooks
      4. Create a Feature
      5. Data Migration
      6. Summary
    2. Appendix B: Profiling Drupal and Optimizing Performance
      1. User-Perceived Performance
      2. What Makes a Web Site Slow?
      3. Real Performance
      4. Summary
    3. Appendix C: Page Rendering and Altering
      1. Step 1: The Router Item
      2. Step 2: The Page Callback Is Fired
      3. Step 3: The Delivery Callback
      4. Step 4: drupal_render_page()
      5. Step 5. hook_page_alter()
      6. Step 6. drupal_render()
    4. Appendix D: Visual Design for Drupal
      1. Why Designers Should Work with Drupal
      2. Designing for Drupal: What It Means
      3. Anatomy of a Drupal Page
      4. Design from the Content Out
      5. Making Your Life Easier As a Drupal Designer
      6. HTML5 in Drupal
      7. How You Can Get Involved
    5. Appendix E: Accessibility
      1. Recent Enhancements
      2. What Are the Standards?
      3. Who Benefits?
      4. It's the Law
      5. Nine Ways to Make Your Site Accessible
    6. Appendix F: Windows Development Environment
      1. LAMP to WISP
      2. Visual Studio
      3. WAMP Stack
      4. Drupal Bits
      5. VS.Php
      6. phpMyAdmin and MySQL Connector
      7. Drush
      8. Summary
    7. Appendix G: Installing Drupal on Ubuntu
      1. Running Ubuntu on Windows or Mac OS X
      2. Customizing Ubuntu for Drupal Development with Drubuntu
      3. Installing Drupal
    8. Appendix H: Mac OSX Installation
      1. Downloading Drupal Core File
    9. Appendix I: Setting Up a Drupal Environment with the Acquia Dev Desktop
      1. Installation
      2. Taking It Further
  21. Index