Chapter 15. Custom Modules
WHAT YOU WILL LEARN IN THIS CHAPTER:
Module basics
Creating a bare-bones module
What a hook is
Building a simple module using a hook
If you have searched drupal.org
for a contributed module that meets your needs and came up empty, or have ever uttered the phrase, "But it should do . . .," then this chapter is for you. In this chapter, you will examine the components of a module so that you can modify existing contributed modules to better fit your needs or, if you'd prefer, to build your own custom module. Written without much technical lingo, this chapter is great if want to learn just enough to customize your site or if you plan to become a full-fledged developer.
This chapter starts off by exploring the file components of a module, and then examines a very short and basic module. When you get your feet wet you'll create a more robust module and learn how to track your changes and give back to the community by using the diff
command. At the end of this chapter, you will be armed with the knowledge necessary to peer into existing modules and understand how they work. Combine this chapter with the next one, and you will know the secrets of how the majority of Drupal modules operate.
WHAT IS A MODULE?
Many newcomers to Drupal find the word module intimidating — as if it were a magic black box of unintelligible gobbledygook that just somehow works. Fortunately, the reality is the exact opposite.
So what is a module? First, the name should be explained. Drupal is ...
Get Beginning 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.