Book description
Pro Drupal 7 Development updates the most popular development reference for the newest major release of Drupal. With several new and completely-rewritten essential APIs and improvements in Drupal 7, this book will not only teach developers how to write modules ranging from simple to complex, as well as learn how Drupal itself works.
Learn the Drupal APIs and major changes in Drupal 7
Learn how to write Drupal modules using the APIs
Learn proper development practices and how to become a contributing community member
Table of contents
- Copyright
- Foreword
- About the Authors
- About the Technical Reviewers
- Acknowledgments
- Introduction
- 1. How Drupal Works
- 2. Writing a Module
- 3. Hooks, Actions, and Triggers
-
4. The Menu System
- 4.1. Callback Mapping
- 4.2. Mapping URLs to Functions
- 4.3. Creating a Menu Item
- 4.4. Page Callback Arguments
- 4.5. Page Callbacks in Other Files
- 4.6. Adding a Link to the Navigation Block
- 4.7. Menu Nesting
- 4.8. Access Control
- 4.9. Title Localization and Customization
- 4.10. Defining a Title Callback
-
4.11. Wildcards in Menu Items
- 4.11.1. Basic Wildcards
- 4.11.2. Wildcards and Page Callback Parameters
- 4.11.3. Using the Value of a Wildcard
- 4.11.4. Wildcards and Parameter Replacement
- 4.11.5. Passing Additional Arguments to the Load Function
- 4.11.6. Special, Predefined Load Arguments: %map and %index
- 4.11.7. Building Paths from Wildcards Using to_arg() Functions
- 4.11.8. Special Cases for Wildcards and to_arg() Functions
- 4.12. Altering Menu Items from Other Modules
- 4.13. Altering Menu Links from Other Modules
- 4.14. Kinds of Menu Items
- 4.15. Common Tasks
- 4.16. Summary
-
5. Working with Databases
- 5.1. Defining Database Parameters
- 5.2. Understanding the Database Abstraction Layer
- 5.3. Connecting to the Database
- 5.4. Performing Simple Queries
- 5.5. Retrieving Query Results
- 5.6. Inserts and Updates with drupal_write_record()
-
5.7. The Schema API
- 5.7.1. Using Module .install Files
- 5.7.2. Creating Tables
- 5.7.3. Using the Schema Module
- 5.7.4. Field Type Mapping from Schema to Database
- 5.7.5. Declaring a Specific Column Type with mysql_type
- 5.7.6. Maintaining Tables
- 5.7.7. Deleting Tables on Uninstall
- 5.7.8. Changing Existing Schemas with hook_schema_alter()
- 5.8. Modifying Other Modules' Queries with hook_query_alter()
- 5.9. Connecting to Multiple Databases Within Drupal
- 5.10. Using a Temporary Table
- 5.11. Writing Your Own Database Driver
- 5.12. Summary
- 6. Working with Users
-
7. Working with Nodes
- 7.1. So What Exactly Is a Node?
- 7.2. Not Everything Is a Node
-
7.3. Creating a Node Module
- 7.3.1. Creating the .install File
- 7.3.2. Creating the .info File
- 7.3.3. Creating the .module File
- 7.3.4. Providing Information About Our Node Type
- 7.3.5. Modifying the Menu Callback
- 7.3.6. Defining Node-Type–Specific Permissions with hook_permission()
- 7.3.7. Limiting Access to a Node Type with hook__node_access()
- 7.3.8. Customizing the Node Form for Our Node Type
- 7.3.9. Validating Fields with hook_validate()
- 7.3.10. Saving Our Data with hook_insert()
- 7.3.11. Keeping Data Current with hook_update()
- 7.3.12. Cleaning Up with hook_delete()
- 7.3.13. Modifying Nodes of Our Type with hook_load()
- 7.3.14. Using hook_view()
- 7.3.15. Manipulating Nodes That Are Not Our Type with hook_node_xxxxx()
- 7.4. How Nodes Are Stored
- 7.5. Creating a Node Type with Custom Content Types
- 7.6. Restricting Access to Nodes
- 7.7. Summary
- 8. Working with Fields
-
9. The Theme System
- 9.1. Themes
- 9.2. The .info File
- 9.3. Understanding Template Files
- 9.4. Summary
- 10. Working with Blocks
-
11. The Form API
-
11.1. Understanding Form Processing
- 11.1.1. Initializing the Process
- 11.1.2. Setting a Token
- 11.1.3. Setting an ID
- 11.1.4. Collecting All Possible Form Element Definitions
- 11.1.5. Looking for a Validation Function
- 11.1.6. Looking for a Submit Function
- 11.1.7. Allowing Modules to Alter the Form Before It's Built
- 11.1.8. Building the Form
- 11.1.9. Allowing Functions to Alter the Form After It's Built
- 11.1.10. Checking If the Form Has Been Submitted
- 11.1.11. Finding a Theme Function for the Form
- 11.1.12. Allowing Modules to Modify the Form Before It's Rendered
- 11.1.13. Rendering the Form
- 11.1.14. Validating the Form
- 11.1.15. Submitting the Form
- 11.1.16. Redirecting the User
-
11.2. Creating Basic Forms
- 11.2.1. Form Properties
- 11.2.2. Form IDs
- 11.2.3. Fieldsets
- 11.2.4. Theming Forms
- 11.2.5. Specifying Validation and Submission Functions with hook_forms()
- 11.2.6. Call Order of Theme, Validation, and Submission Functions
- 11.2.7. Writing a Validation Function
- 11.2.8. Form Rebuilding
- 11.2.9. Writing a Submit Function
- 11.2.10. Changing Forms with hook_form_alter()
- 11.2.11. Submitting Forms Programmatically with drupal_form_submit()
- 11.2.12. Dynamic Forms
-
11.3. Form API Properties
- 11.3.1. Properties for the Root of the Form
- 11.3.2. Properties Added to All Elements
-
11.3.3. Properties Allowed in All Elements
- 11.3.3.1. #type
- 11.3.3.2. #access
- 11.3.3.3. #after_build
- 11.3.3.4. #array_parents
- 11.3.3.5. #attached
- 11.3.3.6. #default_value
- 11.3.3.7. #disabled
- 11.3.3.8. #element_validate
- 11.3.3.9. #parents
- 11.3.3.10. #post_render
- 11.3.3.11. #prefix
- 11.3.3.12. #pre_render
- 11.3.3.13. #process
- 11.3.3.14. #states
- 11.3.3.15. #suffix
- 11.3.3.16. #theme
- 11.3.3.17. #theme_wrappers
- 11.3.3.18. #title
- 11.3.3.19. #tree
- 11.3.3.20. #weight
-
11.3.4. Form Elements
- 11.3.4.1. Text Field
- 11.3.4.2. Password
- 11.3.4.3. Password with Confirmation
- 11.3.4.4. Textarea
- 11.3.4.5. Select
- 11.3.4.6. Radio Buttons
- 11.3.4.7. Check Boxes
- 11.3.4.8. Value
- 11.3.4.9. Hidden
- 11.3.4.10. Date
- 11.3.4.11. Weight
- 11.3.4.12. File Upload
- 11.3.4.13. Fieldset
- 11.3.4.14. Submit
- 11.3.4.15. Button
- 11.3.4.16. Image Button
- 11.3.4.17. Markup
- 11.3.4.18. Item
- 11.3.4.19. #ajax Property
- 11.4. Summary
-
11.1. Understanding Form Processing
- 12. Manipulating User Input: The Filter System
- 13. Searching and Indexing Content
-
14. Working with Files
- 14.1. How Drupal Serves Files
- 14.2. Managed and Unmanaged Drupal APIs
- 14.3. PHP Settings
- 14.4. Media Handling
-
14.5. File API
- 14.5.1. Database Schema
-
14.5.2. Common Tasks and Functions
- 14.5.2.1. Finding the Default Files URI
- 14.5.2.2. Copying and Moving Files
- 14.5.2.3. Checking Directories
-
14.5.2.4. Uploading Files
- 14.5.2.4.1. file_save_upload($source, $validators = array(), $destination = FALSE, $replace = FILE_EXISTS_RENAME)
- 14.5.2.4.2. file_validate_extensions($file, $extensions)
- 14.5.2.4.3. file_validate_is_image($file)
- 14.5.2.4.4. file_validate_image_resolution($file, $maximum_dimensions = 0, $minimum_dimensions = 0)
- 14.5.2.4.5. file_validate_name_length($file)
- 14.5.2.4.6. file_validate_size($file, $file_limit = 0, $user_limit = 0)
- 14.5.2.5. Getting the URL for a File
- 14.5.2.6. Finding Files in a Directory
- 14.5.2.7. Finding the Temp Directory
- 14.5.2.8. Neutralizing Dangerous Files
- 14.5.2.9. Checking Disk Space
- 14.5.3. Authentication Hooks for Downloading
- 14.6. Summary
-
15. Working with Taxonomy
- 15.1. The Structure of Taxonomy
- 15.2. Creating a Vocabulary
- 15.3. Creating Terms
- 15.4. Assigning a Vocabulary to a Content Type
- 15.5. Kinds of Taxonomy
- 15.6. Viewing Content by Term
- 15.7. Storing Taxonomies
- 15.8. Module-Based Vocabularies
- 15.9. Common Tasks
- 15.10. Taxonomy Functions
- 15.11. Additional Resources
- 15.12. Summary
-
16. Caching
- 16.1. Knowing When to Cache
- 16.2. How Caching Works
-
16.3. How Caching Is Used Within Drupal Core
- 16.3.1. Menu System
- 16.3.2. Caching Filtered Text
- 16.3.3. Administration Variables and Module Settings
- 16.3.4. Blocks
- 16.3.5. Using the Cache API
- 16.4. Summary
- 17. Sessions
-
18. Using jQuery
- 18.1. What Is jQuery?
- 18.2. The Old Way
- 18.3. How jQuery Works
- 18.4. jQuery Within Drupal
- 18.5. Building a jQuery Voting Widget
- 18.6. Next Steps
- 18.7. Summary
-
19. Localization and Translation
- 19.1. Enabling the Locale Module
- 19.2. User Interface Translation
- 19.3. Starting a New Translation
- 19.4. Installing a Language Translation
- 19.5. Right-to-Left Language Support
- 19.6. Language Negotiation
- 19.7. Content Translation
- 19.8. Localization- and Translation-Related Files
- 19.9. Additional Resources
- 19.10. Summary
- 20. XML-RPC
-
21. Writing Secure Code
- 21.1. Handling User Input
- 21.2. Handling URLs Securely
- 21.3. Making Queries Secure with db_query()
- 21.4. Keeping Private Data Private with hook_query_alter()
- 21.5. Dynamic Queries
- 21.6. Permissions and Page Callbacks
- 21.7. Cross-Site Request Forgeries (CSRF)
- 21.8. File Security
- 21.9. Encoding Mail Headers
- 21.10. Files for Production Environments
- 21.11. SSL Support
- 21.12. Stand-Alone PHP
- 21.13. AJAX Security, a.k.a. Request Replay Attack
- 21.14. Form API Security
- 21.15. Protecting the Superuser Account
- 21.16. Summary
- 22. Development Best Practices
-
23. Optimizing Drupal
- 23.1. Caching Is the Key to Drupal Performance
- 23.2. Optimizing PHP
- 23.3. Tuning Apache
- 23.4. Using Nginx Instead of Apache
- 23.5. Using Pressflow
- 23.6. Varnish
- 23.7. Boost
- 23.8. Boost vs. Varnish
- 23.9. Linux System Tuning for High Traffic Servers
- 23.10. Using Fast File Systems
- 23.11. Dedicated Servers vs. Virtual Servers
- 23.12. Avoiding Calling External Web Services
- 23.13. Decreasing Server Timeouts
- 23.14. Database Optimization
- 23.15. Drupal Performance
- 23.16. Drupal-Specific Optimizations
- 23.17. Architectures
-
23.18. Finding the Bottleneck
-
23.18.1.
- 23.18.1.1. Web Server Running Out of CPU
- 23.18.1.2. Web Server Running Out of RAM
- 23.18.1.3. Identifying Expensive Database Queries
- 23.18.1.4. Identifying Expensive Pages
- 23.18.1.5. Identifying Expensive Code
- 23.18.1.6. Optimizing Tables
- 23.18.1.7. Caching Queries Manually
- 23.18.1.8. Changing the Table Type from MyISAM to InnoDB
-
23.18.1.
- 23.19. Summary
- 24. Installation Profiles
- 25. Testing
- A. Database Table Reference
- B. Resources
Product information
- Title: Pro Drupal 7 Development, Third Edition
- Author(s):
- Release date: December 2010
- Publisher(s): Apress
- ISBN: 9781430228387
You might also like
book
Beginning Drupal 7
This book focuses on the nontechnical user who is responsible for building, maintaining, and managing Drupal …
book
Pro Drupal as an Enterprise Development Platform
In Pro Drupal as an Enterprise Development Platform authors Jamie Kurtz and Thomas Besluau explain how …
book
Pro Drupal 7 for Windows Developlers
Drupal is a powerful and flexible open source framework for content management. As an open-source community-driven …
book
Drupal 7 Media
If you like building websites with Drupal you’ll love this guide to introducing multimedia to your …