Drupal 7 Test module

Drupal Interview

Hello World Module for Drupal 7

First you have to create the folder under the path sites/all/modules/custom

Give the name “mymodule” to that directory.

Create the mymodule.module file under that directory.

  • mymodule.module file. Path: /sites/all/modules/custome/mymodule

Add the below code into that file.

function mymodule_menu() {
  $items['example'] = array(     
    'title' => 'Hello World Test',
    'page callback' => 'say_hello_world',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
    );
  return $items;
}
 
function say_hello_world() {
  $vars = array();
  $vars['type']="ul";
  $vars['title'] = "";
  $vars['attributes']=array("");
  $vars['items'][0]="This is a simple proof of concept module";
  return theme_item_list($vars);
 }
 
Add mymodule.info file under same directory so mymodule.info file path: sites/all/modules/custom/mymodule 
 
name = mymodule
description = test proof of concept module
package = public-action
version = VERSION
core = 7.x
files[] = mymodule.module
 
;Information added by drupal.org packaging script on 2010-03-21
 version = "7.0-alpha3"
 project = "drupal"
 datestamp = "1269192313"