• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

DCLA-ModuleNotes

Page history last edited by PBworks 16 years, 6 months ago

At a minimum to create a Drupal module you need to have two files

 

  • .info file
  • .module file

 

In the session we create these two files

 

modmenu.info

name = modmenu

description "Modifies the menu location for nodes"

 

 

modmenu.module

function modmenu_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {

if ($node->type == "page") {

if ($op == "insert" || $op == "update") {

drupal_set_message("Modifying the menu");

$menu = array (

'title' => "My Menu",

'description' => "My description",

'pid' => 1,

'path' => 'node/'.$node->nid,

'weight' => 0,

'mid' => 0,

'type' => 86,

);

$node->menu = $menu;

}

}

 

}