I have a node module that I would like to lighten up. I've already moved the admin stuff out to a separate file, but I'd like to also move the node form and submit handlers out too. Since we don't do a menu item for node/add now, how do you get the file name into the menu. I tried hook_menu_alter and it just wouldn't accept the file path; it kept trying to put "modules/node/" on the front of the path.

Comments

nancydru’s picture

vm’s picture

moved to module development forum where you may get better eyes on the thread.

_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

nancydru’s picture

VM, you and Mooffie are just about the only ones who ever answer my questions unless I go on the development list and beg for an answer.

vm’s picture

Unfortunately, I don't have the answer to your question. I've not studied much D6

Have you considered hopping into IRC ?
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

pwolanin’s picture

If you want to put your module's path in using hook_menu_alter(), then you should define 'file path'. See below, when I was doing this in one version of a module for 6.x to get the node form (kind of the opposite of what you are doing, but the menu part will be similar - you need to have a file someplace different from the module).


/**
 * Implementation of hook_menu().
 */
function clone_menu() {
  $items['admin/settings/clone'] = array(
    'access arguments' => array('administer site configuration'),
    'page callback' => 'drupal_get_form',
    'page arguments' => array('clone_settings'),
    'title' => 'Clone module',
    'description' => 'Allows users to clone (copy then edit) an existing node.',
  );
  $items['node/%node/clone'] = array(
    'access callback' => 'clone_access',
    'access arguments' => array(1),
    'page callback' => 'clone_node',
    'page arguments' => array(1),
    'title' => 'Clone',
    'weight' => 5,
    'file' => 'node.pages.inc',
    'file path' => drupal_get_path('module', 'node'),
    'type' => MENU_LOCAL_TASK,
  );
  return $items;
}

---
Work: BioRAFT

nancydru’s picture

We are not supposed to define "node/add/..." to our menus as they get generated automatically. So I can't put 'file path' into a menu entry that I can't specify.

I tried hook_menu_alter:

function quotes_menu_alter(&$callbacks) {
  $callbacks['node/add/quotes']['file'] = 'quotes.pages.inc';
  $callbacks['node/add/quotes']['file path'] = drupal_get_path('module', 'quotes');
}

And it did not work.

Nancy Dru (formerly Nancy W. until I got married to Drupal)

nancydru’s picture

I don't think, even if it worked, that these statements would catch "node/1234/edit"

pwolanin’s picture

Well, it may not work since you also need the node module code (which no longer gets included)

---
Work: BioRAFT