2

I'm adding different way of node editing so I have this code in my module:

$items['node/%node/edit-full'] = array(
'title' => 'Full edit',
'page callback' => 'node_page_edit',
'page arguments' => array(1),
'access callback' => 'node_access',
'access arguments' => array('update', 1),
'weight' => 0,
'type' => MENU_LOCAL_TASK,
'file' => 'node.pages.inc',
'file path' => drupal_get_path('module', 'node'));

What is disturbing.. it changes theme from admin to regular. Instead of Seven Theme I see regular website theme. Am I missing some variable in my definition?

1
  • ( I know there's "theme callback" but for other menu items this isn't needed, and behaves ok )
    – wtk
    Commented Mar 23, 2012 at 10:55

1 Answer 1

2

You need to implement hook_admin_paths() to tell Drupal to use the admin theme for your URL pattern:

Modules may specify whether or not the paths they define in hook_menu() are to be considered administrative. Other modules may use this information to display those pages differently (e.g. in a modal overlay, or in a different theme).

In your case the code would look a lot like this:

function MYMODULE_admin_paths() {
  $paths = array(
    'node/*/edit-full' => TRUE
  );
  return $paths;
}

Once you've cleared the caches your pages should now be using the admin theme.

1
  • Awesome! In other module I used "admin" in path - that's why :) Fast & accurate - Have a nice day!
    – wtk
    Commented Mar 23, 2012 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.