Creating modules with Drupal

Posted by kumarjit in Software, Web Hosting, Web Hosting Tips

1 Star2 Stars (No Ratings Yet)

Creating modules with Drupal

In Drupal – one of the most popular CMS, module can be of 3 types – core modules – that come with the Drupal installation, Community modules – developed by the Open Source community for use with Drupal, and custom modules that are written by the web-designer for custom tasks in his website. Here are the basic steps to creating a module in Drupal.

Create a folder

Create a folder with the short name for your module in sites/all/modules inside your Drupal directory. For example, if the name is examplemod, create the folder sites/all/modules/examplemod.

Create .module file

Create a PHP file named examplemod.module inside the above directory. The file should have the opening “<?php” tag. The closing php tag should be avoided according to the Drupal coding standards.

Create .info file

Create a examplemodule.info file for your module, and implement the hook_help () function to provide a brief description of your module in Drupal’s help system.

Implement hook_perm() and hook_block()

Implement the hook_perm () to specify access permissions for the module and declare and generate the block content using hook_block (). Use hook_block () to make Drupal recognise the module.

Create content and set configuration file

Create a configuration page and generate page content.

BounceWeb provides irresistible offers on Drupal hosting!

Be Sociable, Share!

One Response to “Creating modules with Drupal”

Leave a Reply

You must be logged in to post a comment.