This may be obvious to experienced devs, but I'd like to develop a module that appear in drupal as a page. It will definitely not be a content type where users, or even admins would want to add text. There's a whole lot going on in the background, (php code) but the user has only a couple of options and then clicks on a button to do the task.
I've been doing it as a page inside drupal, but PHP in a text box is getting unmanageable in a hurry.
I've looked at the hooks for page, but it doesn't look like they are set up like forms hooks. I also looked at contact_forms module, but I don't know enough about Drupal to understand why it works.
Am I thinking about this the wrong way?
Any advice is welcome.
Comments
You probably want to create a
You probably want to create a module
Well....
Following the page_example_baz I did the following. I got the module to appear and the permissions are there and I can click them and the Help items appear. However, nothing in the menu.
function grumbler_help ($path, $arg) {
$grum_help = '';
switch ($path) {
case "admin/help#grumbler":
$grum_help = '
' . t("GUIs for group server. This module's children are all of the GUIs"). '
';
break;
case 'admin/modules#grumbler' :
$grum_help = t("GUIs for group server.");
break;
}
return $grum_help;
} //closes function grumbler_help
function grumbler_perm() {
return array ('administer server', 'create server session', 'use server session');
}
function page_grumbler_baz() {
return t('This is where you, the Group Manager, starts a group session');
}
function page_grumbler_menu() {
$items = array(
'title' => 'grumbler',
'access arguments' => array('create server session', 'administer server'),
'type' => MENU_CALLBACK,
'page callback' => 'page_grumbler_baz',
);
return $items;
} //ends menu
You followed an example for
You followed an example for Drupal 5. For Drupal 6 see Creating modules, for hook_menu() see "Letting Drupal know about the new function" (a sub-section of "Creating modules").
huh. Really?
Is all of this at this url wrong then? http://api.drupal.org/api/drupal/developer--examples--page_example.module/6
That link also works, though
That link also works, though you posted code seems to follow a Drupal 5 example, while the link you posted is clearly Drupal 6.
Ok. Still, Problems
Thanks for your help on this.
I deleted everything and started over with the latest release, dropped the database and created a new one. Still, doesn't work.
Does the menu item show up,
Does the menu item show up, if not clear the menu cache.
Otherwise it might be because the default access callback is user_access() and you can only pass it on permission (not even sure 'administer server' is a valid permission).