From 403b0e39d2b4d783bef743f9dda37ac9e93db1e9 Mon Sep 17 00:00:00 2001 From: Silvio Date: Wed, 7 Oct 2009 12:20:40 -0300 Subject: Using theme functions to add css and js --- finder_menu.module | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/finder_menu.module b/finder_menu.module index 793e983..340d300 100644 --- a/finder_menu.module +++ b/finder_menu.module @@ -20,7 +20,8 @@ function finder_menu_uninstall() { * Implementation of hook_init(); */ function finder_menu_init() { - drupal_add_css(drupal_get_path('module', 'finder_menu') .'/finder_menu.css'); + theme('finder_menu_css'); + theme('finder_menu_javascript'); } /** @@ -64,6 +65,12 @@ function finder_menu_theme() { 'parent' => NULL, ), ), + 'finder_menu_javascript' => array( + 'arguments' => array(), + ), + 'finder_menu_css' => array( + 'arguments' => array(), + ), ); } @@ -127,7 +134,6 @@ function theme_finder_menu($menu_name, $mlid) { $output = '
'; $output .= finder_menu_build($menu); $output .= '
'; - drupal_add_js(drupal_get_path('module', 'finder_menu') .'/finder_menu.js'); return $output; } @@ -187,3 +193,21 @@ function finder_menu_has_unhidden_submenu($menu = FALSE) { return FALSE; } + +/** + * Finder Menu Javascript theme function. + * + * @ingroup themeable + */ +function theme_finder_menu_javascript() { + drupal_add_js(drupal_get_path('module', 'finder_menu') .'/finder_menu.js'); +} + +/** + * Finder Menu CSS theme function. + * + * @ingroup themeable + */ +function theme_finder_menu_css() { + drupal_add_css(drupal_get_path('module', 'finder_menu') .'/finder_menu.css'); +} -- cgit v1.2.3