Chapter 2. Drupal Programming Principles
Experienced programmers learn, through 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.
Tip
If you are completely new to Drupal programming, you might find it useful to look at some Drupal code before or while reading this chapter. One suggestion would be to download Examples for Developers. You could try out the Page and Block examples, and take a look at their source code. Or, you might consider browsing through one of the Drupal core modules in the Drupal 7 modules directory or Drupal 8 core/modules directory, although they are not documented as tutorials. The Statistics module for Drupal 7 and 8 (which tracks view statistics and provides a block showing popular content) or the Email module for Drupal 8 (which provides a field for storing email addresses) would be good choices.
Principle: Drupal Is Alterable
Drupal is intended to be used as a platform for building web applications, so one of its fundamental principles is that nearly everything about it needs to be customizable, and ...
Get Programmer's Guide to Drupal, 2nd Edition 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.