makeRIC

Create Something New

Drupal Module Creation

Thu, 2012-04-05 08:55 -- scimonx

 This project will cover the creation of a Drupal sample module.

 

Steps:

  1. Decide what to call your module.  This name will be used thoughout the project.  it should be in all lowercase and should not be the same as a theme name. 
  2. As an example I will use "mymodule" as the name of the new module.  Replace this example name with the name of your module. everywhere it is referenced in the steps.
  3. Create a new folder in your /sites/all/modules folder or your site specific modules folder (e.g., yoursite.com/modules using the name of your new module (forlder name will be "mymodule".
  4. Create another file called "mymodule.info" and open it with an editor.  Remove any contents that were placed there by your editor or IDE...just in case.   Then enter the following:
    name = mymodule
    description = My module's custom description.
    core = 6.x
  5. You can change the core version to whichever you are using.  
  6. Save that file to the "mymodule" folder.  Drupal will not "see" your module without this (mymodle.info) file.
  7. Create a new PHP file with the name "mymodule.module".  This is the main file Drupal will use to integrate your module and will contain the main interface points.

 

Topic Tags: