function block_token_blocks in Block Token 7
Same name and namespace in other branches
- 8 block_token.module \block_token_blocks()
Blocks with tokens.
Parameters
string $token: Token name.
Return value
array|bool If token name provided boolean indicating whether it is on or not otherwise the list of blocks with tokens.
2 calls to block_token_blocks()
- block_token_tokens in ./
block_token.module - Implements hook_tokens().
- block_token_token_info in ./
block_token.module - Implements hook_token_info().
File
- ./
block_token.module, line 87 - The file contains Block Token module code.
Code
function block_token_blocks($token = NULL) {
static $block_token;
if (is_null($block_token)) {
$block_token = array();
$blocks = db_select('block', 'b')
->fields('b', array(
'module',
'delta',
))
->condition('block_token', 1)
->distinct()
->execute();
foreach ($blocks as $block) {
$block_token[block_token_token_name($block->module, $block->delta)] = $block;
}
}
if (!is_null($token)) {
return !empty($block_token[$token]);
}
return $block_token;
}