MENU_CALLBACK, 'page callback' => '_popups_get_raw_content', 'access callback' => TRUE, ); $items['popups/test'] = array( 'title' => 'Popup Test', 'page callback' => 'popups_test_popups', 'type' => MENU_CALLBACK, 'access callback' => TRUE, ); $items['popups/test/response'] = array( 'page callback' => 'popups_test_response', 'type' => MENU_CALLBACK, 'access callback' => TRUE, ); return $items; } // ************************************************************************** // UTILITY FUNCTIONS ******************************************************** // ************************************************************************** /* * Return the content of a path as html, without the page's theming wrapper * Used by dialogs.js for a popups with the content of a link */ function _popups_get_raw_content() { global $base_url; $path = $_GET['path']; $path = substr( $path, strlen($base_url) + 1 ); $content = menu_execute_active_handler( $path ); // does this test for access rights? $output = '
'. drupal_get_title() .'
'; if( $content == MENU_NOT_FOUND ) { $output .= "Path not found: $path"; } elseif($content == MENU_ACCESS_DENIED) { drupal_access_denied(); } else { $output .= $content; } print $output; } function popups_add_popups() { static $added = FALSE; if (!$added) { drupal_add_js(drupal_get_path('module', 'popups') .'/popups.js'); drupal_add_js( array( 'popups'=> array('base_path'=>base_path()) ), 'setting' ); drupal_add_css(drupal_get_path('module', 'popups') .'/popups.css'); $added = TRUE; } } // ************************************************************************** // ADMIN SETTINGS ********************************************************* // ************************************************************************** function popups_admin_settings() { $form = array(); // todo return system_settings_form($form); } // ************************************************************************** // TESTING **************************************************************** // ************************************************************************** function popups_test_popups() { popups_add_popups(); $output = l("Pop Me Up", 'popups/test/response', array( 'attributes'=>array('popups'=>TRUE) ) ); return $output; } function popups_test_response() { drupal_set_title("A Popup Test"); return "
Hello World
"; }