Chapter 2. Drupal Programming Principles
Experienced programmers learn, from training and experience, a set of principles and best practices to apply whenever they approach a problem they want to solve with programming. These include general practices such as "Comment your code" and "Choose clear variable names," which apply to all programming languages and situations, and some that are specific to a particular domain. Drupal has its own set of programming principles (covered in this chapter); learning them and following them should help you be a more effective Drupal programmer.
Note
If you are completely new to Drupal programming, you might find it useful to download the Examples for Developers project from http://drupal.org/project/examples before reading this chapter. Try out the Page and Block examples, and take a look at their source code. Then come back and you’ll have a little more context for learning these principles.
Principle: Drupal Is Alterable
Since Drupal is intended to be used as a platform for building web applications, one of its fundamental principles is that nearly everything about it needs to be customizable, and it needs to be customizable without having to edit its base source code. Since you’re not supposed to need to edit the base code to build any type of web application with Drupal, both Drupal core and contributed modules are (ideally) fully alterable, meaning that they provide hooks that you can use to customize their behavior and output.
The term "hook" ...
Get Programmer's Guide to Drupal now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.