So in my module I added the following code in mymodule_menu

  node_type_cache_reset();
  foreach (node_type_get_types() as $type) {
    $type_url_str = str_replace('_', '-', $type->type);
    $items['new' . $type_url_str] = array(
      'title' => $type->name,
      'title callback' => 'check_plain',
      'page callback' => 'node_add',
      'page arguments' => array($type->type),
      'access callback' => 'node_access',
      'access arguments' => array('create', $type->type),
      'file' => 'node.pages.inc',
      'file path' => drupal_get_path('module', 'node'),
    );
  }

Which is a copy of cores node/add menu item, with file_path added and the url amended. However, the panel page that I setup (and works) for node/%/edit and node/add/% does not take effect at my new path (new/%). The new path does work, it shows a form. Seems strange that it does not show the panel page, considering changes to the node-type fields display (including display suite changes) do take effect.

Comments

merlinofchaos’s picture

Status: Active » Closed (works as designed)

Page Manager uses hook_menu_alter to change the node/%/add page.

Adding a new callback like you're doing will NOT get the override. This isn't a bug, this is a misunderstanding of the system. If you want Page Manager to work on your callback, you'll need to make sure to use its callback (and the data must be exactly the same). If you want it to work similarly to Page Manager but with different data, you may need to either write your own task plugin or write your own callback that invokes the same things as the task plugin and can delegate to it when the data matches what it expects.

For details, see page_manager_node_edit_menu_alter() in ctools/page_manager/plugins/tasks/node_edit.inc

eclipsegc’s picture

You might take a look at the context_admin module. It can deploy new node_type add/edit forms and provides the ability to use the page_manager overrides of them. You won't use hook_menu in that case, you'll have to configure it, and I don't think I've got support written to do that as a string context, but that might not be that hard if you really wanted to. In any event, give it a whirl and see if it's of any help.

http://www.drupal.org/project/context_admin

Eclipse