function blockreference_autocomplete_value in Block reference 6
Same name and namespace in other branches
- 7.2 blockreference.module \blockreference_autocomplete_value()
- 7 blockreference.module \blockreference_autocomplete_value()
Value for a blockreference autocomplete element.
Substitute in the block title for the block bid.
1 string reference to 'blockreference_autocomplete_value'
- blockreference_widget in ./
blockreference.module - Implementation of hook_widget().
File
- ./
blockreference.module, line 474 - Defines a field type for referencing a block from a node.
Code
function blockreference_autocomplete_value($element, $edit = FALSE) {
$field_key = $element['#columns'][0];
if (!empty($element['#default_value'][$field_key])) {
$bid = $element['#default_value'][$field_key];
$args[] = $bid;
$result = db_query(db_rewrite_sql("SELECT b.module, b.delta FROM {blocks} b WHERE b.bid = '%d'", 'blocks', 'bid', $args), $args);
$block = db_fetch_object($result);
$info = module_invoke($block->module, 'block', 'list');
$value = $info[$block->delta]['info'];
$value .= ' [bid:' . $bid . ']';
return array(
$field_key => $value,
);
}
return array(
$field_key => NULL,
);
}