Calling drupal_add_js() in hook_init() causes intermittent error

jbrauer - July 9, 2008 - 06:03
Project:Clean Pagination
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Calling drupal_add_js() in hook_init() results in intermittent errors as the function is undefined until later in the bootstrap.

Fatal error: Call to undefined function drupal_add_js() in /sites/all/modules/cleanpager/cleanpager.module on line 53

#1

jbrauer - July 9, 2008 - 06:05
Status:active» needs review

The attached patch moves drupal_add_js() to the hook_menu() call.

It also addresses coding style issues reported by code-style.pl

AttachmentSize
cleanpager-280217-01.patch 3.42 KB

#2

chrisshattuck - July 31, 2009 - 23:44
Status:needs review» fixed

Wow, Josh, only took me a year to get to this. Eesh. Anyway, committed and done, just in time for a Drupal 7 release!

#3

System Message - August 14, 2009 - 23:50
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.