[...]... Adding artworks Adding new artwork Validation callback Submit callback Saving your artwork Handling revisions 13 8 13 9 14 1 14 2 14 4 14 6 14 6 1 47 14 9 15 1 15 1 15 2 15 2 15 2 15 6 15 6 16 1 16 3 16 3 16 5 1 67 17 0 17 1 17 2 17 5 Viewing artworks Editing an artwork Deleting an artwork Summary 17 6 17 7 17 8 18 2 Chapter 7: Creating New Fields Our goal: a "dimensions" field How Field API works Creating our new field type Declaring... subsystems 1 7 7 8 9 9 10 10 10 11 11 13 13 14 15 16 16 16 17 17 18 18 18 19 19 19 20 20 20 Table of Contents Tools for developing Drupal code Version control with Git and CVS 20 21 The book's code and Git 21 The API site and coding standards Developer-oriented modules 22 22 The developer module Drush (the Drupal shell) Coder 22 23 23 Summary Chapter 2: Creating Your First Module Our goal: a module with... an Admin Interface The User Warn module Starting our module The Drupal menu system Defining a page callback with hook_menu Using wildcards in menu paths Form API Using drupal_ get_form() Building a form callback function Managing persistent data Form submission process [ iii ] 91 91 93 98 99 10 0 10 2 10 3 10 6 1 07 10 8 10 9 11 4 11 8 11 9 11 9 12 0 12 1 12 1 12 5 12 6 1 27 12 8 13 3 13 6 Table of Contents A shortcut... ajax_command_settings 309 309 309 310 310 310 310 310 311 311 311 311 312 Chapter 11 : Working with Files and Images 313 Chapter 12 : Installation Profiles 343 The Twitpic and watermark modules Files in Drupal File API Stream wrappers Creating a stream wrapper Images in Drupal Image API Image Styles Creating image effects Creating image styles from a module Summary Introducing installation profiles Drupal distributions... a widget [ iv ] 18 3 18 3 18 4 18 5 18 5 18 6 18 8 18 8 18 9 19 1 19 1 Table of Contents Simple widget forms Complex widgets Using formatters to display our field Declaring a formatter Single-value formatters Complex formatters Managing non-Field fields Finding entities and fields Summary 19 2 19 4 19 9 200 200 2 01 205 206 210 Chapter 8: Drupal Permissions and Security 211 Chapter 9: Node Access 2 41 Using user_access()... code Staying up to date Summary 375 376 377 377 378 378 379 380 3 81 [ viii ] Preface 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,... Modifying the behavior of other modules Using hook_node_grants_alter() Using hook_node_access_records_alter() Testing and debugging your module Using Devel Node Access 254 254 256 259 260 2 61 263 264 266 266 269 2 71 273 274 275 279 282 282 Summary 285 Using hook_node_access_explain() Using the Devel Node Access by user block Chapter 10 : JavaScript in Drupal JavaScript inside Drupal Adding JavaScript Adding... and other permission checks How Drupal grants node permissions The node_access() function The access whitelist Caching the result for performance Invoking hook_node_access() Access to a user's own nodes Invoking the node access API hook_node_access() compared to {node_access} [] 212 213 2 17 218 219 2 21 224 2 27 228 229 229 230 2 31 233 235 235 236 240 242 242 244 246 246 2 47 248 248 250 Table of Contents... immediate access Table of Contents Preface Chapter 1: Developing for Drupal 7 Introducing Drupal (for developers) Technologies that drive Drupal PHP Databases and MySQL HTML, CSS, and JavaScript Other technologies The web server The Operating System Drupal architecture Drupal core libraries Drupal hooks Drupal core modules The database The theme system Drupal' s major subsystems Themes Menus Nodes Files... Running the installer from the command line Summary 349 354 355 3 57 358 359 360 362 Appendix A: Database Access 363 Appendix B: Security 375 Index 383 Basic queries Result objects Dynamic queries Insert queries Update queries Delete queries Merge queries Advanced subjects Transactions Slave servers Summary 364 365 366 368 370 370 370 372 372 373 374 Thinking securely Filtering versus escaping Filtering Escaping . server 10 The Operating System 11 Drupal architecture 11 Drupal core libraries 13 Drupal hooks 13 Drupal core modules 14 The database 15 The theme system 16 Drupal& apos;s major subsystems 16 Themes. controller 16 1 Entity management 16 3 Managing artwork types 16 3 Adding artworks 16 5 Adding new artwork 1 67 Validation callback 17 0 Submit callback 17 1 Saving your artwork 17 2 Handling revisions 17 5 Viewing. files 11 4 Summary 11 8 Chapter 5: Building an Admin Interface 11 9 The User Warn module 11 9 Starting our module 12 0 The Drupal menu system 12 1 Defining a page callback with hook_menu 12 1 Using wildcards