Telling Drupal about your module

Last updated on
16 May 2017

Main topic described: .info files

All modules must have a 'modulename.info' file, which contains meta information about the module.

The general format is:

name = Module Name 
description = A description of what your module does. 
core = 7.x 

For our module, we will replace 'Module Name' in the example above with the name of our module, 'Current Posts'. Without this file, the module will not show up in the module listing. Here is our specific example:

name = Current Posts 
description = A block module that lists links to recent posts. 
core = 7.x 
package = My Modules 

Add the source above to a file named current_posts.info and save it into the module's directory at sites/all/modules/current_posts.

Note: If you copy and paste this code block, ensure that the description data does not contain a line break (turn off word-wrap on your text-editor to be sure). Otherwise, the .info file will not parse correctly.

.Info File Details

The details of what to put in a .info file can be found on the Writing .info files page.

Check

Your module should now appear in the module list in your site. Go to Modules and scroll down to the bottom of the list in the 'My Modules' category. You should see the module 'Current Posts' or otherwise the name of the module you chose.

(Make sure you created a 'modulename.module' file as described in the tutorial's previous step.)

See also