Chapter 4. Drupal Programming Examples
Now that you have learned the basic principles of Drupal programming and how to avoid making common Drupal programming mistakes, it’s time to put your programming skills to work! This chapter covers special topics in Drupal programming that you can use to enhance websites built with Drupal; they’re all things I’ve actually needed to do either in my freelance work as a Drupal site builder or my volunteer work programming for the Drupal project (for Drupal core and contributed modules). My advice is to skim this chapter now so you know what it covers and then read individual sections in more detail when you need them.
Other places to look for programming examples:
-
The Drupal core code itself, which includes extensive documentation and tests
-
Examples for Developers, which has comprehensive coverage of the Drupal core APIs and how to use them in your own modules
-
Thousands of GPL-licensed contributed modules you can download from https://www.drupal.org/project/modules and then adapt for your own work
-
The API reference site, https://api.drupal.org; see also “Using api.drupal.org”
Registering for URLs and Displaying Content
“How Drupal Handles HTTP Requests” contains overviews of how Drupal 7 and Drupal 8 handle URL requests and return content to a web browser or other requester. This section goes into more detail about how a module you write can be part of that process, by registering with Drupal to handle specific URLs and by providing ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access