27 March 2023

In Drupal 7, you can use the hook_menu() function to define a menu item and specify its callback function. To show a specific admin theme for a menu item, you can use the theme callback parameter in the hook_menu() function.

Source code viewer
  1. /**
  2.  * Implements hook_menu().
  3.  */
  4. function MYMODULE_menu() {
  5. $items = array();
  6.  
  7. $items['my/path'] = array(
  8. 'title' => t('Page Title'),
  9. 'page callback' => 'MYMODULE_page',
  10. // Get current admin theme from variables, and use it as target theme.
  11. 'theme callback' => 'variable_get',
  12. 'theme arguments' => array('admin_theme'),
  13. );
  14.  
  15. return $items;
  16. }
  17.  
Programming Language: PHP