Skip to content
Snippets Groups Projects
Commit a1a556b8 authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#155282 by Jose A Reyero: apply db_rewrite_sql() to the block listing query to...

#155282 by Jose A Reyero: apply db_rewrite_sql() to the block listing query to allow for multilingual blocks
parent b33070d1
No related branches found
No related tags found
No related merge requests found
......@@ -194,7 +194,9 @@ function _db_query_callback($match, $init = FALSE) {
* @param $query
* Query to be rewritten.
* @param $primary_table
* Name or alias of the table which has the primary key field for this query. Possible values are: comments, forum, node, menu, term_data, vocabulary.
* Name or alias of the table which has the primary key field for this query.
* Possible values are: blocks, comments, forum, node, menu, term_data,
* vocabulary.
* @param $primary_field
* Name of the primary field.
* @param $args
......
......@@ -683,7 +683,7 @@ function block_list($region) {
static $blocks = array();
if (!count($blocks)) {
$result = db_query("SELECT DISTINCT b.* FROM {blocks} b LEFT JOIN {blocks_roles} r ON b.module = r.module AND b.delta = r.delta WHERE b.theme = '%s' AND b.status = 1 AND (r.rid IN (%s) OR r.rid IS NULL) ORDER BY b.region, b.weight, b.module", $theme_key, implode(',', array_keys($user->roles)));
$result = db_query(db_rewrite_sql("SELECT DISTINCT b.* FROM {blocks} b LEFT JOIN {blocks_roles} r ON b.module = r.module AND b.delta = r.delta WHERE b.theme = '%s' AND b.status = 1 AND (r.rid IN (%s) OR r.rid IS NULL) ORDER BY b.region, b.weight, b.module", 'b', 'bid'), $theme_key, implode(',', array_keys($user->roles)));
while ($block = db_fetch_object($result)) {
if (!isset($blocks[$block->region])) {
$blocks[$block->region] = array();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment