--- greybox.module 2008-09-24 16:07:12.000000000 +0100 +++ greybox.module.new 2008-09-24 16:06:59.000000000 +0100 @@ -7,28 +7,28 @@ function greybox_perm() { return array('administer greybox'); } +/** + * Implementation of hook_init() + */ +function greybox_init() { + if (variable_get("greybox_enable", TRUE)) { + _greybox_add_files(); + } +} + /** * Implementation of hook_menu(). */ function greybox_menu($maycache) { - $items = array(); - - if ($maycache) { - $items[] = array( - 'path' => 'admin/settings/greybox', - 'title' => t('Greybox'), - 'description' => t('Configure the appearance of Greybox Popup Window.'), - 'callback' => 'drupal_get_form', - 'callback arguments' => 'greybox_settings', - 'access' => user_access('administer greybox'), - 'type' => MENU_NORMAL_ITEM - ); - } - else if (variable_get('greybox_enable', TRUE)) { - greybox_add_files(); - } - + $items['admin/settings/greybox'] = array( + 'title' => 'Greybox', + 'page callback' => 'drupal_get_form', + 'access arguments' => array('administer greybox'), + 'page arguments' => array('greybox_settings'), + 'type' => MENU_NORMAL_ITEM, + 'weight' => 1, + ); return $items; } @@ -80,7 +80,7 @@ function greybox_settings() { return system_settings_form($form); } -function greybox_add_files() { +function _greybox_add_files() { // Load required js and css files. $path = drupal_get_path('module', 'greybox'); $width = variable_get('greybox_window_width', 600);