18.10.2016 Views

Drupal 7 Module Development

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Creating Your First <strong>Module</strong><br />

The focus of this chapter is module creation. In the last chapter we surveyed <strong>Drupal</strong>'s<br />

architecture advanced. We learned about the basic features and subsystems. We also<br />

saw some tools available for development. Now we are going to begin coding.<br />

Here are some of the important topics that we will cover in this chapter:<br />

• Starting a new module<br />

• Creating .info files to provide <strong>Drupal</strong> with module information<br />

• Creating .module files to store <strong>Drupal</strong> code<br />

• Adding new blocks using the Block Subsystem<br />

• Using common <strong>Drupal</strong> functions<br />

• Formatting code according to the <strong>Drupal</strong> coding standards<br />

• Writing an automated test for <strong>Drupal</strong><br />

By the end of this chapter, you should have the foundational knowledge necessary<br />

for building your own module from scratch.<br />

Our goal: a module with a block<br />

In this chapter we are going to build a simple module. The module will use the Block<br />

Subsystem to add a new custom block. The block that we add will simply display a<br />

list of all of the currently enabled modules on our <strong>Drupal</strong> installation.<br />

The block subsystem was introduced in the previous chapter<br />

alongside other important <strong>Drupal</strong> subsystems.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!