I tried to get a list of all blocks for current user under current theme in my module. So I called block_list() function.

But at the very beginning of this function, it expects global variable $theme_key has been assigned. $theme_key is assigned in init_theme() function which is in theme.inc file.

My "page callback" function is invoked before init_theme() is processed so I can get nothing about blocks. What even worse is that, the block list is cached in block_list() function by static variable. So no blocks will be displayed in the request.

I also tried to modify block_list() function - use $conf['theme_default'] instead of $theme_key and it works.

I think block module should not have function depends on init_theme() is processed.
Or should I use another approach to get a block list?

Comments

zhangx1a0’s picture

Title: cannot call block_list() function in customize modules » Cannot use block_list() function in customize modules
Category: support » bug
dpearcefl’s picture

Status: Active » Postponed (maintainer needs more info)

Does this issue exist in current D6?

dpearcefl’s picture

Status: Postponed (maintainer needs more info) » Active

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.