In a project I'm working on I needed to differentiate between node types - I wanted some of the node types forms to appear in the default theme and some to appear in the admin theme.

I didn't want to add the capability to the module itself so i thought a better solution will be to add a drupal_alter function that other modules can manipulate it.

Then if a module want to force the admin theme it implements something like this:

function MY_MODULE_admin_condition_alter(&$data) {
  if (SOME_CONDITION) {
    $data['MY_MODULE'] = FORCE_ADMIN_THEME;
  }
}

And if a module want to force the default theme it uses something like:

function MY_MODULE_admin_condition_alter(&$data) {
  if (SOME_CONDITION) {
    $data['MY_MODULE'] = FORCE_DEFAULT_THEME;
  }
}
CommentFileSizeAuthor
admin.module.diff935 bytesgavri
Support from Acquia helps fund testing for Drupal Acquia logo